//--------------------------------------------------------------------- public void Refresh( AxeCalc app ) { m_tuning.SetupProperties(); // calculate perfect string spacings if( m_bridgePickup.m_eStringSpacing == PickupSettings.Spacing.Perfect ) m_bridgePickup.m_dPerPoleStringSpacing = GetCrossFretboardLine( m_bridgePickup.m_dPosition ).length() / ( m_iStringCount - 1 ); if( m_middlePickup.m_eStringSpacing == PickupSettings.Spacing.Perfect ) m_middlePickup.m_dPerPoleStringSpacing = GetCrossFretboardLine( m_middlePickup.m_dPosition ).length() / ( m_iStringCount - 1 ); if( m_neckPickup.m_eStringSpacing == PickupSettings.Spacing.Perfect ) m_neckPickup.m_dPerPoleStringSpacing = GetCrossFretboardLine( m_neckPickup.m_dPosition ).length() / ( m_iStringCount - 1 ); RefreshFretCharts( app ); // cache the prefab used try { m_currentSaddlePrefab = m_saddlePrefabs[ m_eSaddleStyle ]; } catch { m_currentSaddlePrefab = null; } Type t = typeof( GuitarProperties ); m_calculatedStuff.Remove( "General", "Bridge angle" ); m_calculatedStuff.Remove( "General", "Nut angle" ); if( m_fBassScaleLength != m_fTrebleScaleLength ) { m_calculatedStuff.Add( new CustomProperty( "General", "Bridge angle", "The angle of the bridge from the vertical", "BridgeAngle", this, true, true ) ); m_calculatedStuff.Add( new CustomProperty( "General", "Nut angle", "The angle of the nut from the vertical", "NutAngle", this, true, true ) ); } /* Remove( "Aesthetics", "Fretboard block width" ); Remove( "Aesthetics", "Fretboard block spacing" ); if( m_eMarkerStyle == MarkerStyle.SquareBlocks ) { Add( new CustomProperty( "Aesthetics", "Fretboard block width", "Width of the square fretboard blocks", "SquareBlockWidth", this, false, true ) ); Add( new CustomProperty( "Aesthetics", "Fretboard block spacing", "Spacing between blocks & edge of fretboard", "SquareBlockEdgeSpacing", this, false, true ) ); }*/ }
//--------------------------------------------------------------------- public void RefreshFretCharts( AxeCalc app ) { m_bassFretChartTable.Clear(); m_bassFretChartTable.Columns.Clear(); m_bassFretChartTable.Rows.Clear(); m_trebleFretChartTable.Clear(); m_trebleFretChartTable.Columns.Clear(); m_trebleFretChartTable.Rows.Clear(); Line2[] fretLines = new Line2[ m_iFretCount + 1 ]; for( int i = 0; i <= m_iFretCount; ++i ) fretLines[ i ] = GetFretLine( i ); if( !MultiScale ) { m_bassFretChartTable.Columns.Add( "Fret" ); m_bassFretChartTable.Columns.Add( "From nut" ); m_bassFretChartTable.Columns.Add( "Fret to fret" ); for( int i = 1; i <= m_iFretCount; ++i ) { object[] values = new object[ 3 ]; values[ 0 ] = i; values[ 1 ] = ( fretLines[ 0 ].v1.x - fretLines[ i ].v1.x ).ToString( "F3" ); values[ 2 ] = ( fretLines[ i - 1 ].v1.x - fretLines[ i ].v1.x ).ToString( "F3" ); if( i == 1 ) values[ 2 ] += " (nut - 1)"; else values[ 2 ] += String.Format( " ({0} - {1})", i-1, i ); m_bassFretChartTable.Rows.Add( values ); } } else { m_bassFretChartTable.Columns.Add( "Fret" ); m_bassFretChartTable.Columns.Add( "From reference" ); m_bassFretChartTable.Columns.Add( "Fret to fret" ); m_trebleFretChartTable.Columns.Add( "Fret" ); m_trebleFretChartTable.Columns.Add( "From reference" ); m_trebleFretChartTable.Columns.Add( "Fret to fret" ); // extend all the lines out to the edges of the blank Line2 blankTopLine = new Line2( 0, app.FretboardBlankWidth / 2, 1000, app.FretboardBlankWidth / 2 ); Line2 blankBottomLine = new Line2( 0, -app.FretboardBlankWidth / 2, 1000, -app.FretboardBlankWidth / 2 ); for( int i = 0; i <= m_iFretCount; ++i ) { fretLines[ i ].extendToInfinite( blankTopLine ); fretLines[ i ].extendToInfinite( blankBottomLine ); } double dReferenceX = Math.Max( fretLines[ 0 ].v1.x, fretLines[ 0 ].v2.x ); // bass side for( int i = 0; i <= m_iFretCount; ++i ) { object[] values = new object[ 3 ]; values[ 1 ] = ( dReferenceX - fretLines[ i ].v1.x ).ToString( "F3" ); if( i == 0 ) { values[ 0 ] = "nut"; values[ 2 ] = ( dReferenceX - fretLines[ i ].v1.x ).ToString( "F3" ) + " (ref - nut)"; } else { values[ 0 ] = i; values[ 2 ] = ( fretLines[ i - 1 ].v1.x - fretLines[ i ].v1.x ).ToString( "F3" ); if( i == 1 ) values[ 2 ] += " (nut - 1)"; else values[ 2 ] += String.Format( " ({0} - {1})", i - 1, i ); } m_bassFretChartTable.Rows.Add( values ); } // treble side for( int i = 0; i <= m_iFretCount; ++i ) { object[] values = new object[ 3 ]; values[ 1 ] = ( dReferenceX - fretLines[ i ].v2.x ).ToString( "F3" ); if( i == 0 ) { values[ 0 ] = "nut"; values[ 2 ] = ( dReferenceX - fretLines[ i ].v2.x ).ToString( "F3" ) + " (ref - nut)"; } else { values[ 0 ] = i; values[ 2 ] = ( fretLines[ i - 1 ].v2.x - fretLines[ i ].v2.x ).ToString( "F3" ); if( i == 1 ) values[ 2 ] += " (nut - 1)"; else values[ 2 ] += String.Format( " ({0} - {1})", i - 1, i ); } m_trebleFretChartTable.Rows.Add( values ); } } }
public GuitarProperties( AxeCalc app, CustomClass calculatedStuff ) { // initialize the prefabs m_saddlePrefabs = new Dictionary<SaddleStyles, netDxf.DxfDocument>(); foreach( SaddleStyles style in Enum.GetValues( typeof( SaddleStyles ) ) ) { string strName = Enum.GetName( typeof( SaddleStyles ), style ); try { netDxf.DxfDocument dxf = new netDxf.DxfDocument(); dxf.Load( "Data/Saddles/" + strName + ".dxf" ); m_saddlePrefabs.Add( style, dxf ); } catch { } } m_calculatedStuff = calculatedStuff; m_iStringCount = 6; m_iFretCount = 22; m_iStraightFret = 8; ScaleLength = "630"; TotalBridgeStringSpacing = 51.85; // 52.5; TotalNutStringSpacing = 35.05; // 35.7; FretboardWidthAtNut = 43; FretboardWidthAt12th = 53; m_dFretwireWidth = 2.79; m_dFretwireCrownHeight = 1.32; m_bZeroFret = true; m_dZeroFretNutOffset = 8; m_dNutWidth = 5; m_dStringHeightAt12th = 3; m_dMinStringHeightAt12th = 1.5; m_dMaxStringHeightAt12th = 4; m_dDotRadius = 3; m_dDotEdgeSpacing = 6; m_eMarkerStyle = MarkerStyle.Centred; m_dSquareBlockSpacing = 3; m_dSquareBlockWidth = 30; SaddleStyle = SaddleStyles.Hardtail; m_bridgePickup.Type = PickupTypes.Humbucker; m_bridgePickup.m_dPosition = 43 / 630.0; m_neckPickup.Type = PickupTypes.Humbucker; m_neckPickup.m_dPosition = 148 / 630.0; /* fStratNeckPos = 6.375 / 25.5 fStratMiddlePos = 3.875 / 25.5 fStratBridgePos = 1.625 / 25.5 fStratBridgeBassPos = 1.815 / 25.5 fStratBridgeTreblePos = 1.435 / 25.5 fJBNeckPos = 6 / 34.0 fJBBridgePos = 2.13 / 34.0 fPRSNeckPos = 148 / 635.0 fPRSBridgePos = 43 / 635.0 */ // These are based on what D'Addario's Regular Light strings give on a 25.5" scale guitar m_dPlainSteelStringTensionTarget = 16; m_dNickelWoundStringTensionTarget = 18.5; m_tuning = new Tuning( this, m_calculatedStuff ); Type t = typeof( GuitarProperties ); //Add( new CustomProperty( this, m_iTestValue ) ); AddMarkedUpVariables( this ); Refresh( app ); }