|
|
| version 1.2, 2003/10/28 16:44:44 | version 1.3, 2003/10/30 19:39:52 |
|---|---|
| Line 20 | Line 20 |
| #define getControlValue(a,b) GetControl32BitValue(getControlRefByID(a,b,soundWin)) | #define getControlValue(a,b) GetControl32BitValue(getControlRefByID(a,b,soundWin)) |
| #define setControlValue(a,b,c) SetControl32BitValue(getControlRefByID(a,b,soundWin),c) | #define setControlValue(a,b,c) SetControl32BitValue(getControlRefByID(a,b,soundWin),c) |
| #define getMenuValue (getControlValue(cmd.commandID,0)-1) | |
| #define kMaxNumTabs 6 | #define kMaxNumTabs 6 |
| enum {kTabMasterSig = 'ScrT',kTabMasterID = 1000,kTabPaneSig= 'ScTb'}; | enum {kTabMasterSig = 'ScrT',kTabMasterID = 1000,kTabPaneSig= 'ScTb'}; |
| Line 40 static BYTE spbvrc = 0; | Line 41 static BYTE spbvrc = 0; |
| BYTE* cfg[5] = {&np2cfg.vol_fm, &np2cfg.vol_ssg, &np2cfg.vol_adpcm, &np2cfg.vol_pcm, &np2cfg.vol_rhythm}; | BYTE* cfg[5] = {&np2cfg.vol_fm, &np2cfg.vol_ssg, &np2cfg.vol_adpcm, &np2cfg.vol_pcm, &np2cfg.vol_rhythm}; |
| static void set26jmp(BYTE value, BYTE bit) { | //-----init |
| static void initMixer(BYTE *data) { | |
| if ((snd26 ^ value) & bit) { | short j; |
| snd26 &= ~bit; | for (j=0;j<5;j++) { |
| snd26 |= value; | setControlValue('vMix', j, *(data+j)); |
| } | } |
| } | |
| static void init14(BYTE *data) { | |
| short i; | |
| for (i=0;i<6;i++) { | |
| setControlValue('vMix', i+10, *(data+i)); | |
| } | |
| } | } |
| static void set26s(BYTE chip, OSType io, OSType inturrupt, OSType rom) { | static void set26s(BYTE chip, OSType io, OSType inturrupt, OSType rom) { |
| Line 58 static void set26s(BYTE chip, OSType io, | Line 65 static void set26s(BYTE chip, OSType io, |
| para = 4; | para = 4; |
| } | } |
| setControlValue(rom, 0, para+1); | setControlValue(rom, 0, para+1); |
| Draw1Control(getControlRefByID(io, 0, soundWin)); | |
| Draw1Control(getControlRefByID(inturrupt, 0, soundWin)); | |
| Draw1Control(getControlRefByID(rom, 0, soundWin)); | |
| } | |
| static void initMixer(BYTE *data) { | |
| short j; | |
| for (j=0;j<5;j++) { | |
| setControlValue('vMix', j, *(data+j)); | |
| } | |
| } | |
| static void init14(BYTE *data) { | |
| short i; | |
| for (i=0;i<6;i++) { | |
| setControlValue('vMix', i+10, *(data+i)); | |
| } | |
| } | } |
| static void set86s(void) { | static void set86s(void) { |
| Line 81 static void set86s(void) { | Line 72 static void set86s(void) { |
| static short paranum[4] = {0, 1, 3, 2}; | static short paranum[4] = {0, 1, 3, 2}; |
| setControlValue('86in', 0, paranum[(snd86 >> 2) & 3]+1); | setControlValue('86in', 0, paranum[(snd86 >> 2) & 3]+1); |
| setControlValue('86id', 0, (((~snd86) >> 5) & 7)+1); | setControlValue('86id', 0, (((~snd86) >> 5) & 7)+1); |
| setControlValue('86in', 1, (snd86 & 0x10)?1:0); | setControlValue('86it', 0, (snd86 & 0x10)?1:0); |
| setControlValue('86rm', 1, (snd86 & 0x02)?1:0); | setControlValue('86rm', 0, (snd86 & 0x02)?1:0); |
| } | } |
| static void setSPB(void) { | static void setSPB(void) { |
| Line 101 static void initSoundWindow(void) { | Line 92 static void initSoundWindow(void) { |
| init14(np2cfg.vol14); | init14(np2cfg.vol14); |
| snd26 = np2cfg.snd26opt; | snd26 = np2cfg.snd26opt; |
| uncheckAllPopupMenuItems('26io', 2, soundWin); | |
| uncheckAllPopupMenuItems('26in', 4, soundWin); | |
| uncheckAllPopupMenuItems('26rm', 5, soundWin); | |
| set26s(snd26, '26io', '26in', '26rm'); | set26s(snd26, '26io', '26in', '26rm'); |
| snd86 = np2cfg.snd86opt; | snd86 = np2cfg.snd86opt; |
| uncheckAllPopupMenuItems('86io', 2, soundWin); | |
| uncheckAllPopupMenuItems('86in', 4, soundWin); | |
| uncheckAllPopupMenuItems('86id', 8, soundWin); | |
| set86s(); | set86s(); |
| spb = np2cfg.spbopt; | spb = np2cfg.spbopt; |
| spbvrc = np2cfg.spb_vrc; // ver0.30 | spbvrc = np2cfg.spb_vrc; // ver0.30 |
| uncheckAllPopupMenuItems('spio', 2, soundWin); | |
| uncheckAllPopupMenuItems('spin', 4, soundWin); | |
| uncheckAllPopupMenuItems('sprm', 5, soundWin); | |
| setSPB(); | setSPB(); |
| setControlValue('splv', 0, np2cfg.spb_vrl); | setControlValue('splv', 0, np2cfg.spb_vrl); |
| setControlValue('sprv', 0, np2cfg.spb_x); | setControlValue('sprv', 0, np2cfg.spb_x); |
| Line 115 static void initSoundWindow(void) { | Line 115 static void initSoundWindow(void) { |
| initJoyPad(); | initJoyPad(); |
| } | } |
| static BYTE getsnd26io(void) { | //-----change |
| SInt32 work; | static BYTE getsnd26int(OSType board) { |
| switch (getControlValue(board, 0)) | |
| work = getControlValue('26io', 0); | |
| return((BYTE)((work == 2)?0x10:0x00)); | |
| } | |
| static BYTE getsnd26int(void) { | |
| switch (getControlValue('26in', 0)) | |
| { | { |
| case 1: | case 1: |
| return(0x00); | return(0x00); |
| Line 137 static BYTE getsnd26int(void) { | Line 131 static BYTE getsnd26int(void) { |
| return(0xc0); | return(0xc0); |
| } | } |
| static pascal OSStatus cfWinproc(EventHandlerCallRef myHandler, EventRef event, void* userData) { | static BYTE getsnd86int(void) { |
| OSStatus err = eventNotHandledErr; | switch (getControlValue('86in', 0)) |
| HICommand cmd; | { |
| case 1: | |
| return(0x00); | |
| case 2: | |
| return(0x04); | |
| case 4: | |
| return(0x08); | |
| } | |
| return(0x0c); | |
| } | |
| static BYTE getspbVRch(void) { | |
| BYTE ret = 0; | |
| if (getControlValue('spvl', 0)) { | |
| ret++; | |
| } | |
| if (getControlValue('spvr', 0)) { | |
| ret += 2; | |
| } | |
| return(ret); | |
| } | |
| static void changeSoundOpt(void) { | |
| SINT32 val; | SINT32 val; |
| UInt8 update; | UInt8 update; |
| int renewal; | int renewal; |
| short i,j; | short i,j; |
| BYTE defaultmix[5] = {64, 64, 64, 64, 64}; | |
| renewal = 0; | |
| for (j=0;j<5;j++) { | |
| val = getControlValue('vMix', j); | |
| if (val != *cfg[j]) { | |
| *cfg[j] = val; | |
| renewal = 1; | |
| } | |
| } | |
| if (renewal) { | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| opngen_setvol(np2cfg.vol_fm); | |
| psggen_setvol(np2cfg.vol_ssg); | |
| rhythm_setvol(np2cfg.vol_rhythm); | |
| rhythm_update(&rhythm); | |
| adpcm_setvol(np2cfg.vol_adpcm); | |
| adpcm_update(&adpcm); | |
| pcm86gen_setvol(np2cfg.vol_pcm); | |
| pcm86gen_update(); | |
| renewal = 0; | |
| for (i=0;i<6;i++) { | |
| val = getControlValue('vMix',i+10); | |
| if (val != np2cfg.vol14[i]) { | |
| np2cfg.vol14[i] = val; | |
| renewal = 1; | |
| } | |
| } | |
| if (renewal) { | |
| sysmng_update(SYS_UPDATECFG); | |
| tms3631_setvol(np2cfg.vol14); | |
| } | |
| if (np2cfg.snd26opt != snd26) { | |
| np2cfg.snd26opt = snd26; | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| if (np2cfg.snd86opt != snd86) { | |
| np2cfg.snd86opt = snd86; | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| update = 0; | |
| if (np2cfg.spbopt != spb) { | |
| np2cfg.spbopt = spb; | |
| update |= SYS_UPDATECFG; | |
| } | |
| if (np2cfg.spb_vrc != spbvrc) { | |
| np2cfg.spb_vrc = spbvrc; | |
| update |= SYS_UPDATECFG; | |
| } | |
| val = getControlValue('splv', 0); | |
| if (np2cfg.spb_vrl != val) { | |
| np2cfg.spb_vrl = val; | |
| update |= SYS_UPDATECFG; | |
| } | |
| opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); | |
| val = getControlValue('sprv', 0); | |
| if (np2cfg.spb_x != val) { | |
| np2cfg.spb_x = val; | |
| update |= SYS_UPDATECFG; | |
| } | |
| sysmng_update(update); | |
| changeJoyPadSetup(); | |
| } | |
| static pascal OSStatus cfWinproc(EventHandlerCallRef myHandler, EventRef event, void* userData) { | |
| OSStatus err = eventNotHandledErr; | |
| HICommand cmd; | |
| BYTE defaultmix[5] = {64, 64, 64, 64, 64}; | |
| BYTE b; | |
| if (GetEventClass(event)==kEventClassCommand && GetEventKind(event)==kEventCommandProcess ) { | if (GetEventClass(event)==kEventClassCommand && GetEventKind(event)==kEventCommandProcess ) { |
| GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd); | GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd); |
| Line 155 static pascal OSStatus cfWinproc(EventHa | Line 246 static pascal OSStatus cfWinproc(EventHa |
| break; | break; |
| case '26io': | case '26io': |
| set26jmp(getsnd26io(), 0x10); | setjmper(&snd26, (getMenuValue == 1)?0x10:0x00, 0x10); |
| break; | break; |
| case '26in': | case '26in': |
| set26jmp(getsnd26int(), 0xc0); | setjmper(&snd26, getsnd26int(cmd.commandID), 0xc0); |
| break; | break; |
| case '26rm': | case '26rm': |
| set26jmp(getControlValue('26rm', 0)-1, 0x07); | setjmper(&snd26, getMenuValue, 0x07); |
| break; | break; |
| case '26DF': | case '26DF': |
| snd26 = 0xd1; | snd26 = 0xd1; |
| set26s(snd26, '26io', '26in', '26rm'); | set26s(snd26, '26io', '26in', '26rm'); |
| break; | break; |
| case '86io': | |
| setjmper(&snd86, (getMenuValue == 0)?0x01:0x00, 0x01); | |
| break; | |
| case '86it': | |
| setjmper(&snd86, (getControlValue(cmd.commandID, 0))?0x10:0x00, 0x10); | |
| break; | |
| case '86in': | |
| setjmper(&snd86, getsnd86int(), 0x0c); | |
| break; | |
| case '86id': | |
| setjmper(&snd86, (~getMenuValue & 7) << 5, 0xe0); | |
| break; | |
| case '86rm': | |
| setjmper(&snd86, (getControlValue(cmd.commandID, 0))?0x02:0x00, 0x02); | |
| break; | |
| case '86DF': | case '86DF': |
| snd86 = 0x7f; | snd86 = 0x7f; |
| set86s(); | set86s(); |
| break; | break; |
| case 'spio': | |
| setjmper(&spb, (getMenuValue == 1)?0x10:0x00, 0x10); | |
| break; | |
| case 'spin': | |
| setjmper(&spb, getsnd26int(cmd.commandID), 0xc0); | |
| break; | |
| case 'sprm': | |
| setjmper(&spb, getMenuValue, 0x07); | |
| break; | |
| case 'spvl': | |
| case 'spvr': | |
| b = getspbVRch(); | |
| if ((spbvrc ^ b) & 3) { | |
| spbvrc = b; | |
| } | |
| break; | |
| case 'spDF': | case 'spDF': |
| spb = 0xd1; | spb = 0xd1; |
| spbvrc = 0; | spbvrc = 0; |
| Line 183 static pascal OSStatus cfWinproc(EventHa | Line 314 static pascal OSStatus cfWinproc(EventHa |
| break; | break; |
| case kHICommandOK: | case kHICommandOK: |
| renewal = 0; | changeSoundOpt(); |
| for (j=0;j<5;j++) { | |
| val = getControlValue('vMix', j); | |
| if (val != *cfg[j]) { | |
| *cfg[j] = val; | |
| renewal = 1; | |
| } | |
| } | |
| if (renewal) { | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| opngen_setvol(np2cfg.vol_fm); | |
| psggen_setvol(np2cfg.vol_ssg); | |
| rhythm_setvol(np2cfg.vol_rhythm); | |
| rhythm_update(&rhythm); | |
| adpcm_setvol(np2cfg.vol_adpcm); | |
| adpcm_update(&adpcm); | |
| pcm86gen_setvol(np2cfg.vol_pcm); | |
| pcm86gen_update(); | |
| renewal = 0; | |
| for (i=0;i<6;i++) { | |
| val = getControlValue('vMix',i+10); | |
| if (val != np2cfg.vol14[i]) { | |
| np2cfg.vol14[i] = val; | |
| renewal = 1; | |
| } | |
| } | |
| if (renewal) { | |
| sysmng_update(SYS_UPDATECFG); | |
| tms3631_setvol(np2cfg.vol14); | |
| } | |
| if (np2cfg.snd26opt != snd26) { | |
| np2cfg.snd26opt = snd26; | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| if (np2cfg.snd86opt != snd86) { | |
| np2cfg.snd86opt = snd86; | |
| sysmng_update(SYS_UPDATECFG); | |
| } | |
| update = 0; | |
| if (np2cfg.spbopt != spb) { | |
| np2cfg.spbopt = spb; | |
| update |= SYS_UPDATECFG; | |
| } | |
| if (np2cfg.spb_vrc != spbvrc) { | |
| np2cfg.spb_vrc = spbvrc; | |
| update |= SYS_UPDATECFG; | |
| } | |
| val = getControlValue('spvl', 0); | |
| if (np2cfg.spb_vrl != val) { | |
| np2cfg.spb_vrl = val; | |
| update |= SYS_UPDATECFG; | |
| } | |
| opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); | |
| val = getControlValue('sprv', 0); | |
| if (np2cfg.spb_x != val) { | |
| np2cfg.spb_x = val; | |
| update |= SYS_UPDATECFG; | |
| } | |
| sysmng_update(update); | |
| changeJoyPadSetup(); | |
| endLoop(soundWin); | endLoop(soundWin); |
| err=noErr; | err=noErr; |
| break; | break; |