Merge branch 'master' of https://github.com/tildearrow/furnace into ymf278b
This commit is contained in:
		
						commit
						47d962f736
					
				
							
								
								
									
										
											BIN
										
									
								
								demos/a2600/Funky_Afternoon.fur
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								demos/a2600/Funky_Afternoon.fur
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -2330,6 +2330,13 @@ int DivEngine::mapVelocity(int ch, float vel) { | |||
|   return disCont[dispatchOfChan[ch]].dispatch->mapVelocity(dispatchChanOfChan[ch],vel); | ||||
| } | ||||
| 
 | ||||
| float DivEngine::getGain(int ch, int vol) { | ||||
|   if (ch<0) return 0; | ||||
|   if (ch>=chans) return 0; | ||||
|   if (disCont[dispatchOfChan[ch]].dispatch==NULL) return 0; | ||||
|   return disCont[dispatchOfChan[ch]].dispatch->getGain(dispatchChanOfChan[ch],vol); | ||||
| } | ||||
| 
 | ||||
| unsigned char DivEngine::getOrder() { | ||||
|   return prevOrder; | ||||
| } | ||||
|  |  | |||
|  | @ -927,6 +927,9 @@ class DivEngine { | |||
|     // map MIDI velocity to volume
 | ||||
|     int mapVelocity(int ch, float vel); | ||||
| 
 | ||||
|     // map volume to gain
 | ||||
|     float getGain(int ch, int vol); | ||||
| 
 | ||||
|     // get current order
 | ||||
|     unsigned char getOrder(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -801,6 +801,11 @@ int DivPlatformAY8910::mapVelocity(int ch, float vel) { | |||
|   return round(15.0*pow(vel,0.33)); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformAY8910::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(15-vol)*2.0/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformAY8910::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -144,6 +144,7 @@ class DivPlatformAY8910: public DivDispatch { | |||
|     void* getChanState(int chan); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void setCore(unsigned char core); | ||||
|  |  | |||
|  | @ -792,6 +792,11 @@ int DivPlatformAY8930::mapVelocity(int ch, float vel) { | |||
|   return round(31.0*pow(vel,0.22)); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformAY8930::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(31-vol)*1.5/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformAY8930::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -138,6 +138,7 @@ class DivPlatformAY8930: public DivDispatch { | |||
|     void* getChanState(int chan); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void reset(); | ||||
|  |  | |||
|  | @ -198,6 +198,19 @@ class DivPlatformOPN: public DivPlatformFMBase { | |||
|       if (ch>=psgChanOffs) return round(15.0*pow(vel,0.33)); | ||||
|       return DivPlatformFMBase::mapVelocity(ch,vel); | ||||
|     } | ||||
|     virtual float getGain(int ch, int vol) { | ||||
|       if (vol==0) return 0; | ||||
|       if (ch==csmChan) return 1; | ||||
|       if (ch==adpcmBChanOffs) return (float)vol/255.0; | ||||
|       if (ch>=adpcmAChanOffs) { | ||||
|         return 1.0/pow(10.0,(float)(31-vol)*0.75/20.0); | ||||
|       } | ||||
|       if (ch>=psgChanOffs) { | ||||
|         return 1.0/pow(10.0,(float)(15-vol)*1.5/20.0); | ||||
|       } | ||||
|       return DivPlatformFMBase::getGain(ch,vol); | ||||
|     } | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -136,6 +136,11 @@ class DivPlatformFMBase: public DivDispatch { | |||
|       return CLAMP(round(128.0-(56.0-log2(vel*127.0)*8.0)),0,127); | ||||
|     } | ||||
| 
 | ||||
|     virtual float getGain(int ch, int vol) { | ||||
|       if (vol==0) return 0; | ||||
|       return 1.0/pow(10.0,(float)(127-vol)*0.75/20.0); | ||||
|     } | ||||
| 
 | ||||
|     bool getLegacyAlwaysSetVolume() { | ||||
|       return true; | ||||
|     } | ||||
|  |  | |||
|  | @ -2701,6 +2701,11 @@ int DivPlatformOPL::mapVelocity(int ch, float vel) { | |||
|   return CLAMP(round(64.0-(56.0-log2(vel*127.0)*8.0)),0,63); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformOPL::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(63-vol)*0.75/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformOPL::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -194,6 +194,7 @@ class DivPlatformOPL: public DivDispatch { | |||
|     DivChannelPair getPaired(int chan); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void reset(); | ||||
|  |  | |||
|  | @ -1026,6 +1026,11 @@ int DivPlatformOPLL::mapVelocity(int ch, float vel) { | |||
|   return CLAMP(round(16.0-(14.0-log2(vel*127.0)*2.0)),0,15); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformOPLL::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(15-vol)*3.0/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformOPLL::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -99,6 +99,7 @@ class DivPlatformOPLL: public DivDispatch { | |||
|     DivMacroInt* getChanMacroInt(int ch); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void reset(); | ||||
|  |  | |||
|  | @ -575,6 +575,11 @@ int DivPlatformPCE::mapVelocity(int ch, float vel) { | |||
|   return round(31.0*pow(vel,0.22)); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformPCE::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(31-vol)*3.0/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformPCE::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -90,6 +90,7 @@ class DivPlatformPCE: public DivDispatch { | |||
|     DivSamplePos getSamplePos(int ch); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void reset(); | ||||
|  |  | |||
|  | @ -466,6 +466,11 @@ int DivPlatformSMS::mapVelocity(int ch, float vel) { | |||
|   return round(15.0*pow(vel,0.33)); | ||||
| } | ||||
| 
 | ||||
| float DivPlatformSMS::getGain(int ch, int vol) { | ||||
|   if (vol==0) return 0; | ||||
|   return 1.0/pow(10.0,(float)(15-vol)*2.0/20.0); | ||||
| } | ||||
| 
 | ||||
| unsigned char* DivPlatformSMS::getRegisterPool() { | ||||
|   return regPool; | ||||
| } | ||||
|  |  | |||
|  | @ -80,6 +80,7 @@ class DivPlatformSMS: public DivDispatch { | |||
|     unsigned short getPan(int chan); | ||||
|     DivDispatchOscBuffer* getOscBuffer(int chan); | ||||
|     int mapVelocity(int ch, float vel); | ||||
|     float getGain(int ch, int vol); | ||||
|     unsigned char* getRegisterPool(); | ||||
|     int getRegisterPoolSize(); | ||||
|     void reset(); | ||||
|  |  | |||
|  | @ -4680,7 +4680,7 @@ bool FurnaceGUI::loop() { | |||
|                 if (maxVol<1 || p->data[cursor.y][3]>maxVol) { | ||||
|                   info=fmt::sprintf(_("Set volume: %d (%.2X, INVALID!)"),p->data[cursor.y][3],p->data[cursor.y][3]); | ||||
|                 } else { | ||||
|                   float realVol=e->mapVelocity(cursor.xCoarse,(float)p->data[cursor.y][3]/(float)maxVol); | ||||
|                   float realVol=e->getGain(cursor.xCoarse,p->data[cursor.y][3]); | ||||
|                   info=fmt::sprintf(_("Set volume: %d (%.2X, %d%%)"),p->data[cursor.y][3],p->data[cursor.y][3],(int)(realVol*100.0f/(float)maxVol)); | ||||
|                 } | ||||
|                 hasInfo=true; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 cam900
						cam900