Subversion Repositories svn.mios32

Rev

Rev 2594 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2594 Rev 2595
Line 1... Line 1...
1
// $Id: screen.c 1223 2011-06-23 21:26:52Z hawkeye $
1
// $Id: screen.c 1223 2011-06-23 21:26:52Z hawkeye $
2
2
3
#include <mios32.h>
-
 
4
#include "app_lcd.h"
-
 
5
#include "loopa_datatypes.h"
3
#include "commonIncludes.h"
6
-
 
7
#include <stdio.h>
-
 
8
#include <stdarg.h>
-
 
9
#include <string.h>
-
 
10
-
 
11
#include <app_lcd.h>
-
 
12
#include <seq_bpm.h>
-
 
13
4
14
#include "tasks.h"
5
#include "tasks.h"
15
#include "gfx_resources.h"
6
#include "gfx_resources.h"
16
#include "loopa.h"
7
#include "loopa.h"
-
 
8
#include "ui.h"
17
#include "voxelspace.h"
9
#include "voxelspace.h"
18
-
 
19
10
20
// -------------------------------------------------------------------------------------------
11
// -------------------------------------------------------------------------------------------
21
// SSD 1322 Screen routines by Hawkeye
12
// SSD 1322 Screen routines by Hawkeye
22
13
23
// --- globals ---
14
// --- globals ---
Line 114... Line 105...
114
 *
105
 *
115
 */
106
 */
116
void setFontInverted()
107
void setFontInverted()
117
{
108
{
118
   fontInverted_ = 1;
109
   fontInverted_ = 1;
-
 
110
}
-
 
111
// ----------------------------------------------------------------------------------------
-
 
112
-
 
113
-
 
114
/**
-
 
115
 * Invert a few lines in the screenbuffer (i.e. for highlighting an active line)
-
 
116
 *
-
 
117
 * @param startY
-
 
118
 * @param endY
-
 
119
 */
-
 
120
void invertDisplayLines(u8 startY, u8 endY)
-
 
121
{
-
 
122
   unsigned char* sdata = (unsigned char*) screen + startY * 128;
-
 
123
-
 
124
   u8 x, y;
-
 
125
   for (y = startY; y < endY; y++)
-
 
126
   {
-
 
127
      for (x = 0; x < 128; x++)
-
 
128
      {
-
 
129
         u8 first = *sdata >> 4;
-
 
130
         u8 second = *sdata % 16;
-
 
131
-
 
132
         first = 15-first;
-
 
133
         second = 15-second;
-
 
134
         *sdata = (first << 4) + second;
-
 
135
-
 
136
         sdata++;
-
 
137
      }
-
 
138
   }
119
}
139
}
120
// ----------------------------------------------------------------------------------------
140
// ----------------------------------------------------------------------------------------
121
141
122
142
123
/**
143
/**
Line 619... Line 639...
619
639
620
/**
640
/**
621
 * Display the edit clip page (PAGE_EDIT)
641
 * Display the edit clip page (PAGE_EDIT)
622
 *
642
 *
623
 */
643
 */
624
void displayPageEdit(void)
644
void displayPageClip(void)
625
{
645
{
626
   setFontSmall();
646
   setFontSmall();
627
647
628
   if (screenNewPagePanelFrameCtr_ > 0)
648
   if (screenNewPagePanelFrameCtr_ > 0)
629
   {
649
   {
Line 634... Line 654...
634
      printString(250, 44, "T");
654
      printString(250, 44, "T");
635
      setFontNonInverted();
655
      setFontNonInverted();
636
      screenNewPagePanelFrameCtr_--;
656
      screenNewPagePanelFrameCtr_--;
637
   }
657
   }
638
658
639
   printCenterFormattedString(0, "Edit Settings [Clip %d Scene %c%s]", activeTrack_ + 1, 'A' + activeScene_, sceneChangeNotification_);
659
   printCenterFormattedString(0, "Clip Settings [Clip %d Scene %c%s]", activeTrack_ + 1, 'A' + activeScene_, sceneChangeNotification_);
640
660
641
   command_ == COMMAND_CLIPLEN ? setFontInverted() : setFontNonInverted();
661
   command_ == COMMAND_CLIPLEN ? setFontInverted() : setFontNonInverted();
642
   if (clipSteps_[activeTrack_][activeScene_] < 100)
662
   if (clipSteps_[activeTrack_][activeScene_] < 100)
643
      printFormattedString(0, 54, "Len %d", clipSteps_[activeTrack_][activeScene_]);
663
      printFormattedString(0, 54, "Len %d", clipSteps_[activeTrack_][activeScene_]);
644
   else
664
   else
Line 776... Line 796...
776
}
796
}
777
// ----------------------------------------------------------------------------------------
797
// ----------------------------------------------------------------------------------------
778
798
779
799
780
/**
800
/**
781
 * Display the track midi settings page (PAGE_MIDI)
801
 * Display the track settings page (PAGE_TRACK)
782
 *
802
 *
783
 */
803
 */
784
void displayPageMidi(void)
804
void displayPageTrack(void)
785
{
805
{
786
   setFontSmall();
806
   setFontSmall();
787
807
788
   if (screenNewPagePanelFrameCtr_ > 0)
808
   if (screenNewPagePanelFrameCtr_ > 0)
789
   {
809
   {
790
      setFontInverted();
810
      setFontInverted();
791
      printString(250, 8, "M");
811
      printString(250, 8, "T");
792
      printString(250, 20, "I");
812
      printString(250, 20, "R");
793
      printString(250, 32, "D");
813
      printString(250, 32, "K");
794
      printString(250, 44, "I");
-
 
795
      setFontNonInverted();
814
      setFontNonInverted();
796
      screenNewPagePanelFrameCtr_--;
815
      screenNewPagePanelFrameCtr_--;
797
   }
816
   }
798
817
799
   printCenterFormattedString(0, "MIDI Parameters [Track %d]", activeTrack_ + 1);
818
   printCenterFormattedString(0, "Track Settings [Track %d]", activeTrack_ + 1);
800
819
801
   command_ == COMMAND_PORT ? setFontInverted() : setFontNonInverted();
820
   command_ == COMMAND_PORT ? setFontInverted() : setFontNonInverted();
802
   switch (trackMidiPort_[activeTrack_])
821
   switch (trackMidiPort_[activeTrack_])
803
   {
822
   {
804
      case 0x20: printFormattedString(0, 54, " OUT1 "); break;
823
      case 0x20: printFormattedString(0, 54, " OUT1 "); break;
Line 861... Line 880...
861
}
880
}
862
// ----------------------------------------------------------------------------------------
881
// ----------------------------------------------------------------------------------------
863
882
864
883
865
/**
884
/**
866
 * Display the bpm settings page (PAGE_BPM)
885
 * Display the tempo settings page (PAGE_TEMPO)
867
 *
886
 *
868
 */
887
 */
869
void displayPageBpm(void)
888
void displayPageTempo(void)
870
{
889
{
871
   setFontSmall();
890
   setFontSmall();
872
891
873
   if (screenNewPagePanelFrameCtr_ > 0)
892
   if (screenNewPagePanelFrameCtr_ > 0)
874
   {
893
   {
875
      setFontInverted();
894
      setFontInverted();
876
      printString(250, 14, "B");
895
      printString(250, 14, "T");
877
      printString(250, 26, "P");
896
      printString(250, 26, "M");
878
      printString(250, 38, "M");
897
      printString(250, 38, "P");
-
 
898
      printString(250, 50, "O");
879
      setFontNonInverted();
899
      setFontNonInverted();
880
      screenNewPagePanelFrameCtr_--;
900
      screenNewPagePanelFrameCtr_--;
881
   }
901
   }
882
902
883
   printCenterFormattedString(0, "Tempo Settings", activeTrack_ + 1, activeScene_ + 1);
903
   printCenterFormattedString(0, "Tempo Settings", activeTrack_ + 1, activeScene_ + 1);
Line 886... Line 906...
886
   u16 bpm = SEQ_BPM_IsMaster() ? bpm_ : SEQ_BPM_Get();
906
   u16 bpm = SEQ_BPM_IsMaster() ? bpm_ : SEQ_BPM_Get();
887
   printFormattedString(0, 54, "%d BPM", bpm);
907
   printFormattedString(0, 54, "%d BPM", bpm);
888
908
889
   setFontNonInverted();
909
   setFontNonInverted();
890
   displayClip(activeTrack_);
910
   displayClip(activeTrack_);
-
 
911
}
-
 
912
// ----------------------------------------------------------------------------------------
-
 
913
-
 
914
/**
-
 
915
 * Display the MIDI router settings page (PAGE_ROUTER)
-
 
916
 *
-
 
917
 */
-
 
918
void displayPageRouter(void)
-
 
919
{
-
 
920
   setFontSmall();
-
 
921
-
 
922
   if (screenNewPagePanelFrameCtr_ > 0)
-
 
923
   {
-
 
924
      setFontInverted();
-
 
925
      printString(250, 14, "R");
-
 
926
      printString(250, 26, "O");
-
 
927
      printString(250, 38, "U");
-
 
928
      printString(250, 50, "T");
-
 
929
      setFontNonInverted();
-
 
930
      screenNewPagePanelFrameCtr_--;
-
 
931
   }
-
 
932
-
 
933
   // print routes
-
 
934
   u8 i;
-
 
935
   s8 idx = (s8)(routerActiveRoute_ > 0 ? routerActiveRoute_ - 1 : 0);
-
 
936
   for (i = 0; i < MIDI_ROUTER_NUM_NODES; i++)
-
 
937
   {
-
 
938
      if (i == idx)
-
 
939
      {
-
 
940
         u8 y = (u8) ((i - routerActiveRoute_) * 12 + 28);
-
 
941
         if (y <= 40)
-
 
942
         {
-
 
943
            midi_router_node_entry_t *n = &midi_router_node[i];
-
 
944
            printFormattedString(0, y, "#%d", i + 1);
-
 
945
-
 
946
            if (i == routerActiveRoute_ && command_ == COMMAND_ROUTE_IN_PORT)
-
 
947
               setFontInverted();
-
 
948
            char *port = MIDI_PORT_InNameGet(MIDI_PORT_InIxGet((mios32_midi_port_t) n->src_port));
-
 
949
            printFormattedString(42, y, "%s", port);
-
 
950
            setFontNonInverted();
-
 
951
-
 
952
            if (i == routerActiveRoute_ && command_ == COMMAND_ROUTE_IN_CHANNEL)
-
 
953
               setFontInverted();
-
 
954
            u8 chn = n->src_chn;
-
 
955
            if (chn > 0 && chn < 17)
-
 
956
               printFormattedString(84, y, "%d", chn);
-
 
957
            else
-
 
958
               printFormattedString(84, y, "%s", chn == 17 ? "All" : "---");
-
 
959
            setFontNonInverted();
-
 
960
-
 
961
            if (i == routerActiveRoute_ && command_ == COMMAND_ROUTE_OUT_PORT)
-
 
962
               setFontInverted();
-
 
963
            port = MIDI_PORT_OutNameGet(MIDI_PORT_InIxGet((mios32_midi_port_t) n->dst_port));
-
 
964
            printFormattedString(126, y, "%s", port);
-
 
965
            setFontNonInverted();
-
 
966
-
 
967
            if (i == routerActiveRoute_ && command_ == COMMAND_ROUTE_OUT_CHANNEL)
-
 
968
               setFontInverted();
-
 
969
            chn = n->dst_chn;
-
 
970
            if (chn > 0 && chn < 17)
-
 
971
               printFormattedString(168, y, "%d", chn);
-
 
972
            else
-
 
973
               printFormattedString(168, y, "%s", chn == 17 ? "All" : "---");
-
 
974
            setFontNonInverted();
-
 
975
         }
-
 
976
-
 
977
         idx++;
-
 
978
      }
-
 
979
   }
-
 
980
-
 
981
   invertDisplayLines(27, 41);
-
 
982
-
 
983
   printCenterFormattedString(0, "MIDI Router");
-
 
984
-
 
985
   command_ == COMMAND_ROUTE_SELECT ? setFontInverted() : setFontNonInverted();
-
 
986
   printFormattedString(0, 54, "Select");
-
 
987
   command_ == COMMAND_ROUTE_IN_PORT ? setFontInverted() : setFontNonInverted();
-
 
988
   printFormattedString(42, 54, "IN P");
-
 
989
   command_ == COMMAND_ROUTE_IN_CHANNEL ? setFontInverted() : setFontNonInverted();
-
 
990
   printFormattedString(84, 54, "IN Ch");
-
 
991
   command_ == COMMAND_ROUTE_OUT_PORT ? setFontInverted() : setFontNonInverted();
-
 
992
   printFormattedString(126, 54, "OUT P");
-
 
993
   command_ == COMMAND_ROUTE_OUT_CHANNEL ? setFontInverted() : setFontNonInverted();
-
 
994
   printFormattedString(168, 54, "OUT Ch");
-
 
995
   setFontNonInverted();
-
 
996
891
}
997
}
892
// ----------------------------------------------------------------------------------------
998
// ----------------------------------------------------------------------------------------
893
999
894
1000
895
/**
1001
/**
Line 969... Line 1075...
969
         case PAGE_MUTE:
1075
         case PAGE_MUTE:
970
            displayPageMute();
1076
            displayPageMute();
971
            break;
1077
            break;
972
1078
973
         case PAGE_CLIP:
1079
         case PAGE_CLIP:
974
            displayPageEdit();
1080
            displayPageClip();
975
            break;
1081
            break;
976
1082
977
         case PAGE_NOTES:
1083
         case PAGE_NOTES:
978
            displayPageNotes();
1084
            displayPageNotes();
979
            break;
1085
            break;
980
1086
981
         case PAGE_TRACK:
1087
         case PAGE_TRACK:
982
            displayPageMidi();
1088
            displayPageTrack();
983
            break;
1089
            break;
984
1090
985
         case PAGE_DISK:
1091
         case PAGE_DISK:
986
            displayPageDisk();
1092
            displayPageDisk();
987
            break;
1093
            break;
988
1094
989
         case PAGE_TEMPO:
1095
         case PAGE_TEMPO:
990
            displayPageBpm();
1096
            displayPageTempo();
-
 
1097
            break;
-
 
1098
-
 
1099
         case PAGE_ROUTER:
-
 
1100
            displayPageRouter();
991
            break;
1101
            break;
992
      }
1102
      }
993
   }
1103
   }
994
1104
995
   // Display flash notification
1105
   // Display flash notification