From 96e2acd9f43a5e0c3622459ab54c163bf5d0291e Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 19:59:34 -0700 Subject: [PATCH 1/6] Fix up feature functionality - previous version was cumbersome and terrible. --- format.go | 6 +-- format/common/loadformat.go | 8 +-- format/format.go | 26 +++------ format/it/feature/longchanneloutput.go | 5 ++ format/it/feature/newnoteactions.go | 5 ++ format/it/it.go | 10 ++-- format/it/load/instrument.go | 14 ++--- format/it/load/itformat.go | 12 ++--- format/it/load/load.go | 6 +-- format/it/playback/playback.go | 15 +++--- format/mod/mod.go | 10 ++-- format/s3m/load/load.go | 14 ++--- format/s3m/load/s3mformat.go | 20 +++---- format/s3m/playback/playback.go | 10 ++-- format/s3m/s3m.go | 10 ++-- format/xm/load/load.go | 6 +-- format/xm/load/xmformat.go | 18 +++---- format/xm/playback/playback.go | 10 ++-- format/xm/xm.go | 10 ++-- instrument/sample.go | 49 +++++++++-------- playback.go | 10 +++- player/feature/enabletracing.go | 5 ++ player/feature/feature.go | 47 ----------------- player/feature/ignoreunknowneffect.go | 6 +++ player/feature/playersleepinterval.go | 9 ++++ player/feature/playuntilorderrow.go | 6 +++ player/feature/preconvertsamples.go | 15 ++++++ player/feature/setdefaultbpm.go | 5 ++ player/feature/setdefaulttempo.go | 5 ++ player/feature/songloop.go | 6 +++ player/output/channel.go | 9 ++-- player/output/configintf.go | 16 ------ player/state/channel.go | 2 +- player/voice/voice.go | 2 +- settings/settings.go | 73 -------------------------- voice/pcm/format.go | 4 ++ 36 files changed, 208 insertions(+), 276 deletions(-) create mode 100644 format/it/feature/longchanneloutput.go create mode 100644 format/it/feature/newnoteactions.go create mode 100644 player/feature/enabletracing.go create mode 100644 player/feature/ignoreunknowneffect.go create mode 100644 player/feature/playersleepinterval.go create mode 100644 player/feature/playuntilorderrow.go create mode 100644 player/feature/preconvertsamples.go create mode 100644 player/feature/setdefaultbpm.go create mode 100644 player/feature/setdefaulttempo.go create mode 100644 player/feature/songloop.go delete mode 100644 player/output/configintf.go delete mode 100644 settings/settings.go diff --git a/format.go b/format.go index 1c54bb7..9dcede3 100644 --- a/format.go +++ b/format.go @@ -3,11 +3,11 @@ package playback import ( "io" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) // Format is an interface to a music file format loader type Format[TChannelData any] interface { - Load(filename string, s *settings.Settings) (Playback, error) - LoadFromReader(r io.Reader, s *settings.Settings) (Playback, error) + Load(filename string, features []feature.Feature) (Playback, error) + LoadFromReader(r io.Reader, features []feature.Feature) (Playback, error) } diff --git a/format/common/loadformat.go b/format/common/loadformat.go index c52c8a0..6afd91d 100644 --- a/format/common/loadformat.go +++ b/format/common/loadformat.go @@ -3,15 +3,15 @@ package common import ( "io" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) -type ReaderFunc[TSong any] func(r io.Reader, s *settings.Settings) (*TSong, error) +type ReaderFunc[TSong any] func(r io.Reader, features []feature.Feature) (*TSong, error) type ManagerFactory[TSong, TManager any] func(*TSong) (*TManager, error) -func Load[TSong, TManager any](r io.Reader, reader ReaderFunc[TSong], factory ManagerFactory[TSong, TManager], s *settings.Settings) (*TManager, error) { - song, err := reader(r, s) +func Load[TSong, TManager any](r io.Reader, reader ReaderFunc[TSong], factory ManagerFactory[TSong, TManager], features []feature.Feature) (*TManager, error) { + song, err := reader(r, features) if err != nil { return nil, err } diff --git a/format/format.go b/format/format.go index 5726127..bf3aa2e 100644 --- a/format/format.go +++ b/format/format.go @@ -10,7 +10,7 @@ import ( "github.com/gotracker/playback/format/mod" "github.com/gotracker/playback/format/s3m" "github.com/gotracker/playback/format/xm" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/song" ) @@ -19,16 +19,9 @@ var ( ) // Load loads the a file into a playback manager -func Load(filename string, options ...settings.OptionFunc) (playback.Playback, playback.Format[song.ChannelData], error) { - s := &settings.Settings{} - for _, opt := range options { - if err := opt(s); err != nil { - return nil, nil, err - } - } - +func Load(filename string, features ...feature.Feature) (playback.Playback, playback.Format[song.ChannelData], error) { for _, f := range supportedFormats { - if pb, err := f.Load(filename, s); err == nil { + if pb, err := f.Load(filename, features); err == nil { return pb, f, nil } else if os.IsNotExist(err) { return nil, nil, err @@ -38,21 +31,14 @@ func Load(filename string, options ...settings.OptionFunc) (playback.Playback, p } // LoadFromReader loads a song file on a reader into a playback manager -func LoadFromReader(format string, r io.Reader, options ...settings.OptionFunc) (playback.Playback, playback.Format[song.ChannelData], error) { - s := &settings.Settings{} - for _, opt := range options { - if err := opt(s); err != nil { - return nil, nil, err - } - } - +func LoadFromReader(format string, r io.Reader, features ...feature.Feature) (playback.Playback, playback.Format[song.ChannelData], error) { if format != "" { f, ok := supportedFormats[format] if !ok { return nil, nil, errors.New("unsupported format") } - if pb, err := f.LoadFromReader(r, s); err == nil { + if pb, err := f.LoadFromReader(r, features); err == nil { return pb, f, nil } else { return nil, nil, err @@ -60,7 +46,7 @@ func LoadFromReader(format string, r io.Reader, options ...settings.OptionFunc) } for _, f := range supportedFormats { - if pb, err := f.LoadFromReader(r, s); err == nil { + if pb, err := f.LoadFromReader(r, features); err == nil { return pb, f, nil } else if os.IsNotExist(err) { return nil, nil, err diff --git a/format/it/feature/longchanneloutput.go b/format/it/feature/longchanneloutput.go new file mode 100644 index 0000000..82b439e --- /dev/null +++ b/format/it/feature/longchanneloutput.go @@ -0,0 +1,5 @@ +package feature + +type LongChannelOutput struct { + Enabled bool +} diff --git a/format/it/feature/newnoteactions.go b/format/it/feature/newnoteactions.go new file mode 100644 index 0000000..d3f7722 --- /dev/null +++ b/format/it/feature/newnoteactions.go @@ -0,0 +1,5 @@ +package feature + +type NewNoteActions struct { + Enabled bool +} diff --git a/format/it/it.go b/format/it/it.go index f1d72c3..bc74995 100644 --- a/format/it/it.go +++ b/format/it/it.go @@ -6,7 +6,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/load" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/util" ) @@ -18,16 +18,16 @@ var ( ) // Load loads an IT file into a playback system -func (f format) Load(filename string, s *settings.Settings) (playback.Playback, error) { +func (f format) Load(filename string, features []feature.Feature) (playback.Playback, error) { r, err := util.ReadFile(filename) if err != nil { return nil, err } - return f.LoadFromReader(r, s) + return f.LoadFromReader(r, features) } // LoadFromReader loads an IT file on a reader into a playback system -func (f format) LoadFromReader(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return load.IT(r, s) +func (f format) LoadFromReader(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return load.IT(r, features) } diff --git a/format/it/load/instrument.go b/format/it/load/instrument.go index ad15ecf..b6d342b 100644 --- a/format/it/load/instrument.go +++ b/format/it/load/instrument.go @@ -11,6 +11,7 @@ import ( "github.com/gotracker/gomixing/panning" "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback/period" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/voice" "github.com/gotracker/playback/voice/envelope" "github.com/gotracker/playback/voice/fadeout" @@ -24,7 +25,6 @@ import ( "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/note" oscillatorImpl "github.com/gotracker/playback/oscillator" - "github.com/gotracker/playback/settings" ) type convInst struct { @@ -38,7 +38,7 @@ type convertITInstrumentSettings struct { useHighPassFilter bool } -func convertITInstrumentOldToInstrument(inst *itfile.IMPIInstrumentOld, sampData []itfile.FullSample, convSettings convertITInstrumentSettings, s *settings.Settings) (map[int]*convInst, error) { +func convertITInstrumentOldToInstrument(inst *itfile.IMPIInstrumentOld, sampData []itfile.FullSample, convSettings convertITInstrumentSettings, features []feature.Feature) (map[int]*convInst, error) { outInsts := make(map[int]*convInst) if err := buildNoteSampleKeyboard(outInsts, inst.NoteSampleKeyboard[:]); err != nil { @@ -87,7 +87,7 @@ func convertITInstrumentOldToInstrument(inst *itfile.IMPIInstrumentOld, sampData } ci.Inst = &ii - if err := addSampleInfoToConvertedInstrument(ci.Inst, &id, &sampData[i], volume.Volume(1), convSettings, s); err != nil { + if err := addSampleInfoToConvertedInstrument(ci.Inst, &id, &sampData[i], volume.Volume(1), convSettings, features); err != nil { return nil, err } @@ -132,7 +132,7 @@ func convertITInstrumentOldToInstrument(inst *itfile.IMPIInstrumentOld, sampData return outInsts, nil } -func convertITInstrumentToInstrument(inst *itfile.IMPIInstrument, sampData []itfile.FullSample, convSettings convertITInstrumentSettings, pluginFilters map[int]filter.Factory, s *settings.Settings) (map[int]*convInst, error) { +func convertITInstrumentToInstrument(inst *itfile.IMPIInstrument, sampData []itfile.FullSample, convSettings convertITInstrumentSettings, pluginFilters map[int]filter.Factory, features []feature.Feature) (map[int]*convInst, error) { outInsts := make(map[int]*convInst) if err := buildNoteSampleKeyboard(outInsts, inst.NoteSampleKeyboard[:]); err != nil { @@ -188,7 +188,7 @@ func convertITInstrumentToInstrument(inst *itfile.IMPIInstrument, sampData []itf mixVol := volume.Volume(inst.GlobalVolume.Value()) ci.Inst = &ii - if err := addSampleInfoToConvertedInstrument(ci.Inst, &id, &sampData[i], mixVol, convSettings, s); err != nil { + if err := addSampleInfoToConvertedInstrument(ci.Inst, &id, &sampData[i], mixVol, convSettings, features); err != nil { return nil, err } @@ -337,7 +337,7 @@ func itAutoVibratoWSToProtrackerWS(vibtype uint8) uint8 { } } -func addSampleInfoToConvertedInstrument(ii *instrument.Instrument, id *instrument.PCM, si *itfile.FullSample, instVol volume.Volume, convSettings convertITInstrumentSettings, s *settings.Settings) error { +func addSampleInfoToConvertedInstrument(ii *instrument.Instrument, id *instrument.PCM, si *itfile.FullSample, instVol volume.Volume, convSettings convertITInstrumentSettings, features []feature.Feature) error { instLen := int(si.Header.Length) numChannels := 1 @@ -434,7 +434,7 @@ func addSampleInfoToConvertedInstrument(ii *instrument.Instrument, id *instrumen data = buf.Bytes() } - samp, err := instrument.NewSample(data, instLen, numChannels, format, s) + samp, err := instrument.NewSample(data, instLen, numChannels, format, features) if err != nil { return err } diff --git a/format/it/load/itformat.go b/format/it/load/itformat.go index 36e08a1..043a5ce 100644 --- a/format/it/load/itformat.go +++ b/format/it/load/itformat.go @@ -20,7 +20,7 @@ import ( "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/note" "github.com/gotracker/playback/pattern" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) func moduleHeaderToHeader(fh *itfile.ModuleHeader) (*layout.Header, error) { @@ -86,7 +86,7 @@ func convertItPattern(pkt itfile.PackedPattern, channels int) (*pattern.Pattern[ return pat, int(maxCh), nil } -func convertItFileToSong(f *itfile.File, s *settings.Settings) (*layout.Song, error) { +func convertItFileToSong(f *itfile.File, features []feature.Feature) (*layout.Song, error) { h, err := moduleHeaderToHeader(&f.Head) if err != nil { return nil, err @@ -129,7 +129,7 @@ func convertItFileToSong(f *itfile.File, s *settings.Settings) (*layout.Song, er } switch ii := inst.(type) { case *itfile.IMPIInstrumentOld: - instMap, err := convertITInstrumentOldToInstrument(ii, f.Samples, convSettings, s) + instMap, err := convertITInstrumentOldToInstrument(ii, f.Samples, convSettings, features) if err != nil { return nil, err } @@ -139,7 +139,7 @@ func convertItFileToSong(f *itfile.File, s *settings.Settings) (*layout.Song, er } case *itfile.IMPIInstrument: - instMap, err := convertITInstrumentToInstrument(ii, f.Samples, convSettings, song.FilterPlugins, s) + instMap, err := convertITInstrumentToInstrument(ii, f.Samples, convSettings, song.FilterPlugins, features) if err != nil { return nil, err } @@ -245,11 +245,11 @@ func addSampleWithNoteMapToSong(song *layout.Song, sample *instrument.Instrument } } -func readIT(r io.Reader, s *settings.Settings) (*layout.Song, error) { +func readIT(r io.Reader, features []feature.Feature) (*layout.Song, error) { f, err := itfile.Read(r) if err != nil { return nil, err } - return convertItFileToSong(f, s) + return convertItFileToSong(f, features) } diff --git a/format/it/load/load.go b/format/it/load/load.go index a97c6c7..735c73e 100644 --- a/format/it/load/load.go +++ b/format/it/load/load.go @@ -6,10 +6,10 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/common" itPlayback "github.com/gotracker/playback/format/it/playback" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) // IT loads an IT file from a reader -func IT(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return common.Load(r, readIT, itPlayback.NewManager, s) +func IT(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return common.Load(r, readIT, itPlayback.NewManager, features) } diff --git a/format/it/playback/playback.go b/format/it/playback/playback.go index bfe4d82..f40b6d1 100644 --- a/format/it/playback/playback.go +++ b/format/it/playback/playback.go @@ -6,6 +6,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" + itFeature "github.com/gotracker/playback/format/it/feature" "github.com/gotracker/playback/format/it/layout" itPeriod "github.com/gotracker/playback/format/it/period" "github.com/gotracker/playback/format/it/playback/state/pattern" @@ -132,10 +133,12 @@ func (m *Manager) SetNumChannels(num int) { func (m *Manager) channelInit(ch int) *output.Channel { return &output.Channel{ - ChannelNum: ch, - Filter: nil, - Config: m, - ChannelVolume: volume.Volume(1), + ChannelNum: ch, + Filter: nil, + GetSampleRate: m.GetSampleRate, + SetGlobalVolume: m.SetGlobalVolume, + GetOPL2Chip: m.GetOPL2Chip, + ChannelVolume: volume.Volume(1), } } @@ -269,9 +272,9 @@ func (m *Manager) Configure(features []feature.Feature) error { m.pattern.SongLoop = f case feature.PlayUntilOrderAndRow: m.pattern.PlayUntilOrderAndRow = f - case feature.ITLongChannelOutput: + case itFeature.LongChannelOutput: m.longChannelOutput = f.Enabled - case feature.ITNewNoteActions: + case itFeature.NewNoteActions: m.enableNewNoteActions = f.Enabled for ch := range m.channels { cs := &m.channels[ch] diff --git a/format/mod/mod.go b/format/mod/mod.go index c6e745e..4585795 100644 --- a/format/mod/mod.go +++ b/format/mod/mod.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/load" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/util" ) @@ -17,17 +17,17 @@ var ( ) // Load loads an MOD file into a playback system -func (f format) Load(filename string, s *settings.Settings) (playback.Playback, error) { +func (f format) Load(filename string, features []feature.Feature) (playback.Playback, error) { r, err := util.ReadFile(filename) if err != nil { return nil, err } - return f.LoadFromReader(r, s) + return f.LoadFromReader(r, features) } // LoadFromReader loads a MOD file on a reader into a playback system -func (f format) LoadFromReader(r io.Reader, s *settings.Settings) (playback.Playback, error) { +func (f format) LoadFromReader(r io.Reader, features []feature.Feature) (playback.Playback, error) { // we really just load the mod into an S3M layout, since S3M is essentially a superset - return load.MOD(r, s) + return load.MOD(r, features) } diff --git a/format/s3m/load/load.go b/format/s3m/load/load.go index d8b6a86..8051631 100644 --- a/format/s3m/load/load.go +++ b/format/s3m/load/load.go @@ -8,10 +8,10 @@ import ( "github.com/gotracker/playback/format/s3m/layout" "github.com/gotracker/playback/format/s3m/load/modconv" s3mPlayback "github.com/gotracker/playback/format/s3m/playback" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) -func readMOD(r io.Reader, s *settings.Settings) (*layout.Song, error) { +func readMOD(r io.Reader, features []feature.Feature) (*layout.Song, error) { f, err := modconv.Read(r) if err != nil { return nil, err @@ -19,15 +19,15 @@ func readMOD(r io.Reader, s *settings.Settings) (*layout.Song, error) { return convertS3MFileToSong(f, func(patNum int) uint8 { return 64 - }, s, true) + }, features, true) } // MOD loads a MOD file and upgrades it into an S3M file internally -func MOD(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return common.Load(r, readMOD, s3mPlayback.NewManager, s) +func MOD(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return common.Load(r, readMOD, s3mPlayback.NewManager, features) } // S3M loads an S3M file into a new Playback object -func S3M(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return common.Load(r, readS3M, s3mPlayback.NewManager, s) +func S3M(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return common.Load(r, readS3M, s3mPlayback.NewManager, features) } diff --git a/format/s3m/load/s3mformat.go b/format/s3m/load/s3mformat.go index d096b26..d45faf8 100644 --- a/format/s3m/load/s3mformat.go +++ b/format/s3m/load/s3mformat.go @@ -10,6 +10,7 @@ import ( "github.com/gotracker/gomixing/panning" "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback/period" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/voice/fadeout" "github.com/gotracker/playback/voice/loop" "github.com/gotracker/playback/voice/pcm" @@ -21,7 +22,6 @@ import ( "github.com/gotracker/playback/index" "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/pattern" - "github.com/gotracker/playback/settings" ) func moduleHeaderToHeader(fh *s3mfile.ModuleHeader) (*layout.Header, error) { @@ -57,7 +57,7 @@ func scrsNoneToInstrument(scrs *s3mfile.SCRSFull, si *s3mfile.SCRSNoneHeader) (* return &sample, nil } -func scrsDp30ToInstrument(scrs *s3mfile.SCRSFull, si *s3mfile.SCRSDigiplayerHeader, signedSamples bool, s *settings.Settings) (*instrument.Instrument, error) { +func scrsDp30ToInstrument(scrs *s3mfile.SCRSFull, si *s3mfile.SCRSDigiplayerHeader, signedSamples bool, features []feature.Feature) (*instrument.Instrument, error) { sample := instrument.Instrument{ Static: instrument.StaticValues{ Filename: scrs.Head.GetFilename(), @@ -108,7 +108,7 @@ func scrsDp30ToInstrument(scrs *s3mfile.SCRSFull, si *s3mfile.SCRSDigiplayerHead idata.SustainLoop = loop.NewLoop(sustainMode, sustainSettings) - samp, err := instrument.NewSample(scrs.Sample, instLen, numChannels, format, s) + samp, err := instrument.NewSample(scrs.Sample, instLen, numChannels, format, features) if err != nil { return nil, err } @@ -165,8 +165,8 @@ func scrsOpl2ToInstrument(scrs *s3mfile.SCRSFull, si *s3mfile.SCRSAdlibHeader) ( return &inst, nil } -func convertSCRSFullToInstrument(scrs *s3mfile.SCRSFull, signedSamples bool, s *settings.Settings) (*instrument.Instrument, error) { - if s == nil { +func convertSCRSFullToInstrument(scrs *s3mfile.SCRSFull, signedSamples bool, features []feature.Feature) (*instrument.Instrument, error) { + if scrs == nil { return nil, errors.New("scrs is nil") } @@ -176,7 +176,7 @@ func convertSCRSFullToInstrument(scrs *s3mfile.SCRSFull, signedSamples bool, s * case *s3mfile.SCRSNoneHeader: return scrsNoneToInstrument(scrs, si) case *s3mfile.SCRSDigiplayerHeader: - return scrsDp30ToInstrument(scrs, si, signedSamples, s) + return scrsDp30ToInstrument(scrs, si, signedSamples, features) case *s3mfile.SCRSAdlibHeader: return scrsOpl2ToInstrument(scrs, si) default: @@ -253,7 +253,7 @@ func convertS3MPackedPattern(pkt s3mfile.PackedPattern, numRows uint8) (*pattern return pat, int(maxCh) } -func convertS3MFileToSong(f *s3mfile.File, getPatternLen func(patNum int) uint8, s *settings.Settings, wasModFile bool) (*layout.Song, error) { +func convertS3MFileToSong(f *s3mfile.File, getPatternLen func(patNum int) uint8, features []feature.Feature, wasModFile bool) (*layout.Song, error) { h, err := moduleHeaderToHeader(&f.Head) if err != nil { return nil, err @@ -288,7 +288,7 @@ func convertS3MFileToSong(f *s3mfile.File, getPatternLen func(patNum int) uint8, song.Instruments = make([]*instrument.Instrument, len(f.Instruments)) for instNum, scrs := range f.Instruments { - sample, err := convertSCRSFullToInstrument(&scrs, signedSamples, s) + sample, err := convertSCRSFullToInstrument(&scrs, signedSamples, features) if err != nil { return nil, err } @@ -365,7 +365,7 @@ func convertS3MFileToSong(f *s3mfile.File, getPatternLen func(patNum int) uint8, return &song, nil } -func readS3M(r io.Reader, s *settings.Settings) (*layout.Song, error) { +func readS3M(r io.Reader, features []feature.Feature) (*layout.Song, error) { f, err := s3mfile.Read(r) if err != nil { return nil, err @@ -373,5 +373,5 @@ func readS3M(r io.Reader, s *settings.Settings) (*layout.Song, error) { return convertS3MFileToSong(f, func(patNum int) uint8 { return 64 - }, s, false) + }, features, false) } diff --git a/format/s3m/playback/playback.go b/format/s3m/playback/playback.go index 704b0d5..28cd603 100644 --- a/format/s3m/playback/playback.go +++ b/format/s3m/playback/playback.go @@ -114,10 +114,12 @@ func NewManager(song *layout.Song) (*Manager, error) { func (m *Manager) channelInit(ch int) *output.Channel { return &output.Channel{ - ChannelNum: ch, - Filter: nil, - Config: m, - ChannelVolume: volume.Volume(1), + ChannelNum: ch, + Filter: nil, + GetSampleRate: m.GetSampleRate, + SetGlobalVolume: m.SetGlobalVolume, + GetOPL2Chip: m.GetOPL2Chip, + ChannelVolume: volume.Volume(1), } } diff --git a/format/s3m/s3m.go b/format/s3m/s3m.go index 195a4a6..d752c54 100644 --- a/format/s3m/s3m.go +++ b/format/s3m/s3m.go @@ -6,7 +6,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/load" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/util" ) @@ -18,16 +18,16 @@ var ( ) // Load loads an S3M file into a playback system -func (f format) Load(filename string, s *settings.Settings) (playback.Playback, error) { +func (f format) Load(filename string, features []feature.Feature) (playback.Playback, error) { r, err := util.ReadFile(filename) if err != nil { return nil, err } - return f.LoadFromReader(r, s) + return f.LoadFromReader(r, features) } // Load loads an S3M file on a reader into a playback system -func (f format) LoadFromReader(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return load.S3M(r, s) +func (f format) LoadFromReader(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return load.S3M(r, features) } diff --git a/format/xm/load/load.go b/format/xm/load/load.go index de7fa60..5c2f475 100644 --- a/format/xm/load/load.go +++ b/format/xm/load/load.go @@ -6,10 +6,10 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/common" xmPlayback "github.com/gotracker/playback/format/xm/playback" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" ) // XM loads an XM file and upgrades it into an XM file internally -func XM(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return common.Load(r, readXM, xmPlayback.NewManager, s) +func XM(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return common.Load(r, readXM, xmPlayback.NewManager, features) } diff --git a/format/xm/load/xmformat.go b/format/xm/load/xmformat.go index f2fa753..2c949d3 100644 --- a/format/xm/load/xmformat.go +++ b/format/xm/load/xmformat.go @@ -9,6 +9,7 @@ import ( "github.com/gotracker/gomixing/panning" "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback/period" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/voice" "github.com/gotracker/playback/voice/envelope" "github.com/gotracker/playback/voice/fadeout" @@ -25,7 +26,6 @@ import ( "github.com/gotracker/playback/note" "github.com/gotracker/playback/oscillator" "github.com/gotracker/playback/pattern" - "github.com/gotracker/playback/settings" ) func moduleHeaderToHeader(fh *xmfile.ModuleHeader) (*layout.Header, error) { @@ -59,7 +59,7 @@ func xmAutoVibratoWSToProtrackerWS(vibtype uint8) uint8 { } } -func xmInstrumentToInstrument(inst *xmfile.InstrumentHeader, linearFrequencySlides bool, s *settings.Settings) ([]*instrument.Instrument, map[int][]note.Semitone, error) { +func xmInstrumentToInstrument(inst *xmfile.InstrumentHeader, linearFrequencySlides bool, features []feature.Feature) ([]*instrument.Instrument, map[int][]note.Semitone, error) { noteMap := make(map[int][]note.Semitone) var instruments []*instrument.Instrument @@ -210,7 +210,7 @@ func xmInstrumentToInstrument(inst *xmfile.InstrumentHeader, linearFrequencySlid ii.PanEnv.Loop = loop.NewLoop(panEnvLoopMode, panEnvLoopSettings) ii.PanEnv.Sustain = loop.NewLoop(panEnvSustainMode, panEnvSustainSettings) - samp, err := instrument.NewSample(si.SampleData, instLen, numChannels, format, s) + samp, err := instrument.NewSample(si.SampleData, instLen, numChannels, format, features) if err != nil { return nil, nil, err } @@ -243,12 +243,12 @@ func xmLoopModeToLoopMode(mode xmfile.SampleLoopMode) loop.Mode { } } -func convertXMInstrumentToInstrument(ih *xmfile.InstrumentHeader, linearFrequencySlides bool, s *settings.Settings) ([]*instrument.Instrument, map[int][]note.Semitone, error) { +func convertXMInstrumentToInstrument(ih *xmfile.InstrumentHeader, linearFrequencySlides bool, features []feature.Feature) ([]*instrument.Instrument, map[int][]note.Semitone, error) { if ih == nil { return nil, nil, errors.New("instrument is nil") } - return xmInstrumentToInstrument(ih, linearFrequencySlides, s) + return xmInstrumentToInstrument(ih, linearFrequencySlides, features) } func convertXmPattern(pkt xmfile.Pattern) (*pattern.Pattern[channel.Data], int) { @@ -280,7 +280,7 @@ func convertXmPattern(pkt xmfile.Pattern) (*pattern.Pattern[channel.Data], int) return pat, int(maxCh) } -func convertXmFileToSong(f *xmfile.File, s *settings.Settings) (*layout.Song, error) { +func convertXmFileToSong(f *xmfile.File, features []feature.Feature) (*layout.Song, error) { h, err := moduleHeaderToHeader(&f.Head) if err != nil { return nil, err @@ -301,7 +301,7 @@ func convertXmFileToSong(f *xmfile.File, s *settings.Settings) (*layout.Song, er } for instNum, ih := range f.Instruments { - samples, noteMap, err := convertXMInstrumentToInstrument(&ih, linearFrequencySlides, s) + samples, noteMap, err := convertXMInstrumentToInstrument(&ih, linearFrequencySlides, features) if err != nil { return nil, err } @@ -371,11 +371,11 @@ func convertXmFileToSong(f *xmfile.File, s *settings.Settings) (*layout.Song, er return &song, nil } -func readXM(r io.Reader, s *settings.Settings) (*layout.Song, error) { +func readXM(r io.Reader, features []feature.Feature) (*layout.Song, error) { f, err := xmfile.Read(r) if err != nil { return nil, err } - return convertXmFileToSong(f, s) + return convertXmFileToSong(f, features) } diff --git a/format/xm/playback/playback.go b/format/xm/playback/playback.go index 007e39e..3d38ea9 100644 --- a/format/xm/playback/playback.go +++ b/format/xm/playback/playback.go @@ -85,10 +85,12 @@ func NewManager(song *layout.Song) (*Manager, error) { func (m *Manager) channelInit(ch int) *output.Channel { return &output.Channel{ - ChannelNum: ch, - Filter: nil, - Config: m, - ChannelVolume: volume.Volume(1), + ChannelNum: ch, + Filter: nil, + GetSampleRate: m.GetSampleRate, + SetGlobalVolume: m.SetGlobalVolume, + GetOPL2Chip: m.GetOPL2Chip, + ChannelVolume: volume.Volume(1), } } diff --git a/format/xm/xm.go b/format/xm/xm.go index 935991d..e27de1d 100644 --- a/format/xm/xm.go +++ b/format/xm/xm.go @@ -6,7 +6,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/load" - "github.com/gotracker/playback/settings" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/util" ) @@ -18,16 +18,16 @@ var ( ) // Load loads an XM file into a playback system -func (f format) Load(filename string, s *settings.Settings) (playback.Playback, error) { +func (f format) Load(filename string, features []feature.Feature) (playback.Playback, error) { r, err := util.ReadFile(filename) if err != nil { return nil, err } - return f.LoadFromReader(r, s) + return f.LoadFromReader(r, features) } // LoadFromReader loads an XM file on a reader into a playback system -func (f format) LoadFromReader(r io.Reader, s *settings.Settings) (playback.Playback, error) { - return load.XM(r, s) +func (f format) LoadFromReader(r io.Reader, features []feature.Feature) (playback.Playback, error) { + return load.XM(r, features) } diff --git a/instrument/sample.go b/instrument/sample.go index 88c5ccd..cb4f65e 100644 --- a/instrument/sample.go +++ b/instrument/sample.go @@ -2,45 +2,44 @@ package instrument import ( "github.com/gotracker/gomixing/volume" + "github.com/gotracker/playback/player/feature" "github.com/gotracker/playback/voice/pcm" - - "github.com/gotracker/playback/settings" ) -func NewSample(data []byte, length int, channels int, format pcm.SampleDataFormat, s *settings.Settings) (pcm.Sample, error) { +func NewSample(data []byte, length int, channels int, format pcm.SampleDataFormat, features []feature.Feature) (pcm.Sample, error) { sf := format - if v, ok := s.Get(settings.NamePreferredSampleFormat); ok { - if val, ok := v.(pcm.SampleDataFormat); ok { - sf = val + for _, feat := range features { + switch f := feat.(type) { + case feature.PreConvertSamples: + if f.Enabled { + sf = f.DesiredFormat + } } } - var sample pcm.Sample if sf == format { - sample = pcm.NewSample(data, length, channels, format) - } else { - inSample := pcm.NewSample(data, length, channels, format) + // original format + return pcm.NewSample(data, length, channels, format), nil + } + + inSample := pcm.NewSample(data, length, channels, format) + if sf != pcm.SampleDataFormatNative { + // format conversion outSample, err := pcm.ConvertTo(inSample, sf) if err != nil { return nil, err } - sample = outSample + return outSample, nil } - if v, ok := s.Get(settings.NameUseNativeSampleFormat); ok { - if val, ok := v.(bool); ok && val { - inSample := sample - nativeData := make([]volume.Matrix, 0, length) - for i := 0; i < length; i++ { - d, err := inSample.Read() - if err != nil { - return nil, err - } - nativeData = append(nativeData, d) - } - sample = pcm.NewSampleNative(nativeData, length, channels) + // native conversion + nativeData := make([]volume.Matrix, 0, length) + for i := 0; i < length; i++ { + d, err := inSample.Read() + if err != nil { + return nil, err } + nativeData = append(nativeData, d) } - - return sample, nil + return pcm.NewSampleNative(nativeData, length, channels), nil } diff --git a/playback.go b/playback.go index e3adeca..38930b4 100644 --- a/playback.go +++ b/playback.go @@ -3,18 +3,24 @@ package playback import ( "time" + "github.com/gotracker/gomixing/volume" device "github.com/gotracker/gosound" "github.com/gotracker/playback/index" "github.com/gotracker/playback/pattern" + "github.com/gotracker/playback/period" "github.com/gotracker/playback/player/feature" - "github.com/gotracker/playback/player/output" "github.com/gotracker/playback/song" + "github.com/gotracker/playback/voice/render" ) // Playback is an interface for rendering a song to output data type Playback interface { - output.ConfigIntf + SetupSampler(int, int, int) error + GetSampleRate() period.Frequency + GetOPL2Chip() render.OPL2Chip + GetGlobalVolume() volume.Volume + SetGlobalVolume(volume.Volume) Update(time.Duration, chan<- *device.PremixData) error Generate(time.Duration) (*device.PremixData, error) diff --git a/player/feature/enabletracing.go b/player/feature/enabletracing.go new file mode 100644 index 0000000..516ea05 --- /dev/null +++ b/player/feature/enabletracing.go @@ -0,0 +1,5 @@ +package feature + +type EnableTracing struct { + Filename string +} diff --git a/player/feature/feature.go b/player/feature/feature.go index d70bba2..1b3d970 100644 --- a/player/feature/feature.go +++ b/player/feature/feature.go @@ -1,51 +1,4 @@ package feature -import "time" - // Feature is an interface for player features that can be optionally modified by the user and/or disabled by an output device type Feature any - -// SongLoop is a setting for enabling or disabling the song looping -type SongLoop struct { - Count int -} - -// PlayerSleepInterval describes the player sleep feature -type PlayerSleepInterval struct { - Enabled bool - Interval time.Duration -} - -// IgnoreUnknownEffect describes a bypass/ignore of unknown effects -type IgnoreUnknownEffect struct { - Enabled bool -} - -type EnableTracing struct { - Filename string -} - -type PreConvertSamples struct { - Enabled bool -} - -type PlayUntilOrderAndRow struct { - Order int - Row int -} - -type ITLongChannelOutput struct { - Enabled bool -} - -type ITNewNoteActions struct { - Enabled bool -} - -type SetDefaultTempo struct { - Tempo int -} - -type SetDefaultBPM struct { - BPM int -} diff --git a/player/feature/ignoreunknowneffect.go b/player/feature/ignoreunknowneffect.go new file mode 100644 index 0000000..9f3a16f --- /dev/null +++ b/player/feature/ignoreunknowneffect.go @@ -0,0 +1,6 @@ +package feature + +// IgnoreUnknownEffect describes a bypass/ignore of unknown effects +type IgnoreUnknownEffect struct { + Enabled bool +} diff --git a/player/feature/playersleepinterval.go b/player/feature/playersleepinterval.go new file mode 100644 index 0000000..990f37f --- /dev/null +++ b/player/feature/playersleepinterval.go @@ -0,0 +1,9 @@ +package feature + +import "time" + +// PlayerSleepInterval describes the player sleep feature +type PlayerSleepInterval struct { + Enabled bool + Interval time.Duration +} diff --git a/player/feature/playuntilorderrow.go b/player/feature/playuntilorderrow.go new file mode 100644 index 0000000..cbc9228 --- /dev/null +++ b/player/feature/playuntilorderrow.go @@ -0,0 +1,6 @@ +package feature + +type PlayUntilOrderAndRow struct { + Order int + Row int +} diff --git a/player/feature/preconvertsamples.go b/player/feature/preconvertsamples.go new file mode 100644 index 0000000..756678c --- /dev/null +++ b/player/feature/preconvertsamples.go @@ -0,0 +1,15 @@ +package feature + +import "github.com/gotracker/playback/voice/pcm" + +type PreConvertSamples struct { + Enabled bool + DesiredFormat pcm.SampleDataFormat +} + +func UseNativeSampleFormat(enabled bool) Feature { + return PreConvertSamples{ + Enabled: enabled, + DesiredFormat: pcm.SampleDataFormatNative, + } +} diff --git a/player/feature/setdefaultbpm.go b/player/feature/setdefaultbpm.go new file mode 100644 index 0000000..5620787 --- /dev/null +++ b/player/feature/setdefaultbpm.go @@ -0,0 +1,5 @@ +package feature + +type SetDefaultBPM struct { + BPM int +} diff --git a/player/feature/setdefaulttempo.go b/player/feature/setdefaulttempo.go new file mode 100644 index 0000000..204a0b8 --- /dev/null +++ b/player/feature/setdefaulttempo.go @@ -0,0 +1,5 @@ +package feature + +type SetDefaultTempo struct { + Tempo int +} diff --git a/player/feature/songloop.go b/player/feature/songloop.go new file mode 100644 index 0000000..82b22a2 --- /dev/null +++ b/player/feature/songloop.go @@ -0,0 +1,6 @@ +package feature + +// SongLoop is a setting for enabling or disabling the song looping +type SongLoop struct { + Count int +} diff --git a/player/output/channel.go b/player/output/channel.go index b63fa0f..8c30386 100644 --- a/player/output/channel.go +++ b/player/output/channel.go @@ -3,6 +3,7 @@ package output import ( "github.com/gotracker/playback/filter" "github.com/gotracker/playback/period" + "github.com/gotracker/playback/voice/render" "github.com/gotracker/gomixing/volume" ) @@ -11,7 +12,9 @@ import ( type Channel struct { ChannelNum int Filter filter.Filter - Config ConfigIntf + GetSampleRate func() period.Frequency + SetGlobalVolume func(volume.Volume) + GetOPL2Chip func() render.OPL2Chip ChannelVolume volume.Volume LastGlobalVolume volume.Volume // this is the channel's version of the GlobalVolume } @@ -40,7 +43,3 @@ func (oc *Channel) SetFilterEnvelopeValue(envVal int8) { oc.Filter.UpdateEnv(envVal) } } - -func (oc *Channel) GetSampleRate() period.Frequency { - return oc.Config.GetSampleRate() -} diff --git a/player/output/configintf.go b/player/output/configintf.go deleted file mode 100644 index aea41e0..0000000 --- a/player/output/configintf.go +++ /dev/null @@ -1,16 +0,0 @@ -package output - -import ( - "github.com/gotracker/playback/period" - "github.com/gotracker/playback/voice/render" - - "github.com/gotracker/gomixing/volume" -) - -type ConfigIntf interface { - SetupSampler(int, int, int) error - GetSampleRate() period.Frequency - GetOPL2Chip() render.OPL2Chip - GetGlobalVolume() volume.Volume - SetGlobalVolume(volume.Volume) -} diff --git a/player/state/channel.go b/player/state/channel.go index e1bf76b..3e27c28 100644 --- a/player/state/channel.go +++ b/player/state/channel.go @@ -381,7 +381,7 @@ func (cs *ChannelState[TMemory, TChannelData]) GetOutputChannel() *output.Channe // SetGlobalVolume sets the last-known global volume on the channel func (cs *ChannelState[TMemory, TChannelData]) SetGlobalVolume(gv volume.Volume) { cs.Output.LastGlobalVolume = gv - cs.Output.Config.SetGlobalVolume(gv) + cs.Output.SetGlobalVolume(gv) } // SetChannelVolume sets the channel volume on the channel diff --git a/player/voice/voice.go b/player/voice/voice.go index 3cc302a..ea352df 100644 --- a/player/voice/voice.go +++ b/player/voice/voice.go @@ -33,7 +33,7 @@ func New(inst *instrument.Instrument, output *output.Channel) voice.Voice { }) case *instrument.OPL2: return NewOPL2(OPLConfiguration{ - Chip: output.Config.GetOPL2Chip(), + Chip: output.GetOPL2Chip(), Channel: output.ChannelNum, C2SPD: inst.GetC2Spd(), InitialVolume: inst.GetDefaultVolume(), diff --git a/settings/settings.go b/settings/settings.go deleted file mode 100644 index 76e34db..0000000 --- a/settings/settings.go +++ /dev/null @@ -1,73 +0,0 @@ -package settings - -import ( - "errors" - - "github.com/heucuva/optional" - - "github.com/gotracker/playback/voice/pcm" -) - -const ( - NamePreferredSampleFormat string = "PreferredSampleFormat" - NameUseNativeSampleFormat string = "UseNativeSampleFormat" - NameDisplayITLongChannelOutput string = "DisplayITLongChannelOutput" - NameEnableNewNoteActions string = "EnableNewNoteActions" -) - -type Settings struct { - Values map[string]optional.Value[any] -} - -// GetOption returns the current option by name -func (s Settings) GetOption(name string) *optional.Value[any] { - if s.Values == nil { - return nil - } - if v, ok := s.Values[name]; ok { - return &v - } - return nil -} - -// Get returns the current value by name -func (s Settings) Get(name string) (any, bool) { - if v := s.GetOption(name); v != nil { - return v.Get() - } - return nil, false -} - -// Set sets a value by name -func (s *Settings) Set(name string, value any) error { - if s.Values == nil { - s.Values = make(map[string]optional.Value[any]) - } - var v optional.Value[any] - v.Set(value) - s.Values[name] = v - return nil -} - -// OptionFunc is an option setting function -type OptionFunc func(s *Settings) error - -// PreferredSampleFormat sets the preferred sample format for the samples in the song -// this will up- and down-convert the existing formats as necessary. -func PreferredSampleFormat(format pcm.SampleDataFormat) OptionFunc { - return func(s *Settings) error { - if s == nil { - return errors.New("settings is nil") - } - return s.Set(NamePreferredSampleFormat, format) - } -} - -func UseNativeSampleFormat(enabled bool) OptionFunc { - return func(s *Settings) error { - if s == nil { - return errors.New("settings is nil") - } - return s.Set(NameUseNativeSampleFormat, enabled) - } -} diff --git a/voice/pcm/format.go b/voice/pcm/format.go index 65d9a2e..cc7dd53 100755 --- a/voice/pcm/format.go +++ b/voice/pcm/format.go @@ -1,5 +1,7 @@ package pcm +import "math" + // SampleDataFormat is the format of the sample data type SampleDataFormat uint8 @@ -25,3 +27,5 @@ const ( // SampleDataFormat64BitBEFloat is for big-endian, 64-bit floating-point data SampleDataFormat64BitBEFloat ) + +const SampleDataFormatNative = math.MaxUint8 From 60c6a9101fdc7e5e79c048506b18746e3d801b46 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 20:12:41 -0700 Subject: [PATCH 2/6] Clean up some nonsense with unnecessary deferreds --- format/it/playback/playback.go | 3 --- format/s3m/playback/playback.go | 3 --- format/xm/playback/playback.go | 3 --- 3 files changed, 9 deletions(-) diff --git a/format/it/playback/playback.go b/format/it/playback/playback.go index f40b6d1..2593d06 100644 --- a/format/it/playback/playback.go +++ b/format/it/playback/playback.go @@ -79,7 +79,6 @@ func NewManager(song *layout.Song) (*Manager, error) { } txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(song.Head.InitialSpeed) txn.Tempo.Set(song.Head.InitialTempo) @@ -286,14 +285,12 @@ func (m *Manager) Configure(features []feature.Feature) error { } case feature.SetDefaultTempo: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(f.Tempo) if err := txn.Commit(); err != nil { return err } case feature.SetDefaultBPM: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Tempo.Set(f.BPM) if err := txn.Commit(); err != nil { return err diff --git a/format/s3m/playback/playback.go b/format/s3m/playback/playback.go index 28cd603..a62f78f 100644 --- a/format/s3m/playback/playback.go +++ b/format/s3m/playback/playback.go @@ -100,7 +100,6 @@ func NewManager(song *layout.Song) (*Manager, error) { } txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(song.Head.InitialSpeed) txn.Tempo.Set(song.Head.InitialTempo) @@ -290,14 +289,12 @@ func (m *Manager) Configure(features []feature.Feature) error { m.pattern.PlayUntilOrderAndRow = f case feature.SetDefaultTempo: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(f.Tempo) if err := txn.Commit(); err != nil { return err } case feature.SetDefaultBPM: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Tempo.Set(f.BPM) if err := txn.Commit(); err != nil { return err diff --git a/format/xm/playback/playback.go b/format/xm/playback/playback.go index 3d38ea9..d728d41 100644 --- a/format/xm/playback/playback.go +++ b/format/xm/playback/playback.go @@ -71,7 +71,6 @@ func NewManager(song *layout.Song) (*Manager, error) { } txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(song.Head.InitialSpeed) txn.Tempo.Set(song.Head.InitialTempo) @@ -261,14 +260,12 @@ func (m *Manager) Configure(features []feature.Feature) error { m.pattern.PlayUntilOrderAndRow = f case feature.SetDefaultTempo: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Ticks.Set(f.Tempo) if err := txn.Commit(); err != nil { return err } case feature.SetDefaultBPM: txn := m.pattern.StartTransaction() - defer txn.Cancel() txn.Tempo.Set(f.BPM) if err := txn.Commit(); err != nil { return err From 67afa4ffa8beb405bc022a6247e2b209c8cbd0c2 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 20:27:59 -0700 Subject: [PATCH 3/6] removed cli-only feature struct --- player/feature/playersleepinterval.go | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 player/feature/playersleepinterval.go diff --git a/player/feature/playersleepinterval.go b/player/feature/playersleepinterval.go deleted file mode 100644 index 990f37f..0000000 --- a/player/feature/playersleepinterval.go +++ /dev/null @@ -1,9 +0,0 @@ -package feature - -import "time" - -// PlayerSleepInterval describes the player sleep feature -type PlayerSleepInterval struct { - Enabled bool - Interval time.Duration -} From da47af84b39028c9c43b250ff06da3db2b498662 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 21:17:34 -0700 Subject: [PATCH 4/6] Clean up instruments, voices, and interfaces --- instrument/instrument.go | 51 ++++++++++++++------------------------- instrument/opl2.go | 26 +++++++++++++++----- instrument/pcm.go | 9 +++++++ instrument/util.go | 13 +++++++--- player/tick.go | 6 ++--- player/tracker.go | 10 ++++---- player/tracker_tracing.go | 2 +- player/voice/opl2.go | 4 +-- player/voice/pcm.go | 4 +-- player/voice/voice.go | 4 +-- 10 files changed, 72 insertions(+), 57 deletions(-) diff --git a/instrument/instrument.go b/instrument/instrument.go index 36b56db..efeae86 100644 --- a/instrument/instrument.go +++ b/instrument/instrument.go @@ -1,8 +1,6 @@ package instrument import ( - "math" - "github.com/gotracker/gomixing/sampling" "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback/period" @@ -30,19 +28,19 @@ type StaticValues struct { // Instrument is the mildly-decoded instrument/sample header type Instrument struct { Static StaticValues - Inst DataIntf + Inst Data C2Spd period.Frequency Finetune optional.Value[note.Finetune] } // IsInvalid always returns false (valid) -func (inst *Instrument) IsInvalid() bool { +func (inst Instrument) IsInvalid() bool { return false } // GetC2Spd returns the C2SPD value for the instrument // This may get mutated if a finetune effect is processed -func (inst *Instrument) GetC2Spd() period.Frequency { +func (inst Instrument) GetC2Spd() period.Frequency { return inst.C2Spd } @@ -52,20 +50,13 @@ func (inst *Instrument) SetC2Spd(c2spd period.Frequency) { } // GetDefaultVolume returns the default volume value for the instrument -func (inst *Instrument) GetDefaultVolume() volume.Volume { +func (inst Instrument) GetDefaultVolume() volume.Volume { return inst.Static.Volume } // GetLength returns the length of the instrument -func (inst *Instrument) GetLength() sampling.Pos { - switch si := inst.Inst.(type) { - case *OPL2: - return sampling.Pos{Pos: math.MaxInt64, Frac: 0} - case *PCM: - return sampling.Pos{Pos: si.Sample.Length()} - default: - } - return sampling.Pos{} +func (inst Instrument) GetLength() sampling.Pos { + return inst.Inst.GetLength() } // SetFinetune sets the finetune value on the instrument @@ -74,7 +65,7 @@ func (inst *Instrument) SetFinetune(ft note.Finetune) { } // GetFinetune returns the finetune value on the instrument -func (inst *Instrument) GetFinetune() note.Finetune { +func (inst Instrument) GetFinetune() note.Finetune { if ft, ok := inst.Finetune.Get(); ok { return ft } @@ -82,53 +73,47 @@ func (inst *Instrument) GetFinetune() note.Finetune { } // GetID returns the instrument number (1-based) -func (inst *Instrument) GetID() ID { +func (inst Instrument) GetID() ID { return inst.Static.ID } // GetSemitoneShift returns the amount of semitones worth of shift to play the instrument at -func (inst *Instrument) GetSemitoneShift() int8 { +func (inst Instrument) GetSemitoneShift() int8 { return inst.Static.RelativeNoteNumber } // GetKind returns the kind of the instrument -func (inst *Instrument) GetKind() Kind { - switch inst.Inst.(type) { - case *PCM: - return KindPCM - case *OPL2: - return KindOPL2 - } - return KindPCM +func (inst Instrument) GetKind() Kind { + return inst.Inst.GetKind() } // GetNewNoteAction returns the NewNoteAction associated to the instrument -func (inst *Instrument) GetNewNoteAction() note.Action { +func (inst Instrument) GetNewNoteAction() note.Action { return inst.Static.NewNoteAction } // GetData returns the instrument-specific data interface -func (inst *Instrument) GetData() DataIntf { +func (inst Instrument) GetData() Data { return inst.Inst } // GetFilterFactory returns the factory for the channel filter -func (inst *Instrument) GetFilterFactory() filter.Factory { +func (inst Instrument) GetFilterFactory() filter.Factory { return inst.Static.FilterFactory } // GetPluginFilterFactory returns the factory for the channel plugin filter -func (inst *Instrument) GetPluginFilterFactory() filter.Factory { +func (inst Instrument) GetPluginFilterFactory() filter.Factory { return inst.Static.PluginFilter } // GetAutoVibrato returns the settings for the autovibrato system -func (inst *Instrument) GetAutoVibrato() voice.AutoVibrato { +func (inst Instrument) GetAutoVibrato() voice.AutoVibrato { return inst.Static.AutoVibrato } // IsReleaseNote returns true if the note is a release (Note-Off) -func (inst *Instrument) IsReleaseNote(n note.Note) bool { +func (inst Instrument) IsReleaseNote(n note.Note) bool { switch n.Type() { case note.SpecialTypeStopOrRelease: return inst.GetKind() == KindOPL2 @@ -137,7 +122,7 @@ func (inst *Instrument) IsReleaseNote(n note.Note) bool { } // IsStopNote returns true if the note is a stop (Note-Cut) -func (inst *Instrument) IsStopNote(n note.Note) bool { +func (inst Instrument) IsStopNote(n note.Note) bool { switch n.Type() { case note.SpecialTypeStopOrRelease: return inst.GetKind() == KindPCM diff --git a/instrument/opl2.go b/instrument/opl2.go index a6e49e4..5c2ddac 100644 --- a/instrument/opl2.go +++ b/instrument/opl2.go @@ -1,5 +1,11 @@ package instrument +import ( + "math" + + "github.com/gotracker/gomixing/sampling" +) + // OPL2OperatorData is the operator data for an OPL2/Adlib instrument type OPL2OperatorData struct { // KeyScaleRateSelect returns true if the modulator's envelope scales with keys @@ -70,8 +76,16 @@ type OPL2 struct { AdditiveSynthesis bool } +func (OPL2) GetKind() Kind { + return KindOPL2 +} + +func (OPL2) GetLength() sampling.Pos { + return sampling.Pos{Pos: math.MaxInt64} +} + // GetReg20 calculates the Register 0x20 value -func (o *OPL2OperatorData) GetReg20() uint8 { +func (o OPL2OperatorData) GetReg20() uint8 { reg20 := uint8(0x00) if o.Tremolo { reg20 |= 0x80 @@ -91,7 +105,7 @@ func (o *OPL2OperatorData) GetReg20() uint8 { } // GetReg40 calculates the Register 0x40 value -func (o *OPL2OperatorData) GetReg40() uint8 { +func (o OPL2OperatorData) GetReg40() uint8 { oVol := uint8(o.Volume) if oVol > 63 { oVol = 63 @@ -105,7 +119,7 @@ func (o *OPL2OperatorData) GetReg40() uint8 { } // GetReg60 calculates the Register 0x60 value -func (o *OPL2OperatorData) GetReg60() uint8 { +func (o OPL2OperatorData) GetReg60() uint8 { reg60 := uint8(0x00) reg60 |= (o.AttackRate & 0x0f) << 4 reg60 |= o.DecayRate & 0x0f @@ -113,7 +127,7 @@ func (o *OPL2OperatorData) GetReg60() uint8 { } // GetReg80 calculates the Register 0x80 value -func (o *OPL2OperatorData) GetReg80() uint8 { +func (o OPL2OperatorData) GetReg80() uint8 { reg80 := uint8(0x00) reg80 |= (15 - (o.SustainLevel & 0x0f)) << 4 reg80 |= o.ReleaseRate & 0x0f @@ -121,7 +135,7 @@ func (o *OPL2OperatorData) GetReg80() uint8 { } // GetRegC0 calculates the Register 0xC0 value -func (inst *OPL2) GetRegC0() uint8 { +func (inst OPL2) GetRegC0() uint8 { regC0 := uint8(0x00) regC0 |= 0x20 | 0x10 // right and left enable [OPL3 only] regC0 |= uint8(inst.ModulationFeedback&0x7) << 1 @@ -132,7 +146,7 @@ func (inst *OPL2) GetRegC0() uint8 { } // GetRegE0 calculates the Register 0xE0 value -func (o *OPL2OperatorData) GetRegE0() uint8 { +func (o OPL2OperatorData) GetRegE0() uint8 { regE0 := uint8(0x00) regE0 |= uint8(o.WaveformSelection & 0x07) return regE0 diff --git a/instrument/pcm.go b/instrument/pcm.go index 577f457..a9d43af 100644 --- a/instrument/pcm.go +++ b/instrument/pcm.go @@ -2,6 +2,7 @@ package instrument import ( "github.com/gotracker/gomixing/panning" + "github.com/gotracker/gomixing/sampling" "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback/voice/envelope" "github.com/gotracker/playback/voice/fadeout" @@ -22,3 +23,11 @@ type PCM struct { PitchFiltMode bool // true = filter, false = pitch PitchFiltEnv envelope.Envelope[int8] // this is either pitch or filter } + +func (PCM) GetKind() Kind { + return KindPCM +} + +func (p PCM) GetLength() sampling.Pos { + return sampling.Pos{Pos: p.Sample.Length()} +} diff --git a/instrument/util.go b/instrument/util.go index ca36ded..bd03d4b 100644 --- a/instrument/util.go +++ b/instrument/util.go @@ -1,6 +1,10 @@ package instrument -import "fmt" +import ( + "fmt" + + "github.com/gotracker/gomixing/sampling" +) // ID is an identifier for an instrument/sample that means something to the format type ID interface { @@ -8,8 +12,11 @@ type ID interface { fmt.Stringer } -// DataIntf is the interface to implementation-specific functions on an instrument -type DataIntf any +// Data is the interface to implementation-specific functions on an instrument +type Data interface { + GetKind() Kind + GetLength() sampling.Pos +} // Kind defines the kind of instrument type Kind int diff --git a/player/tick.go b/player/tick.go index 3af796d..452d11d 100644 --- a/player/tick.go +++ b/player/tick.go @@ -1,12 +1,12 @@ package player -// TickableIntf is an interface which exposes the OnTick call -type TickableIntf interface { +// Tickable is an interface which exposes the OnTick call +type Tickable interface { OnTick() error } // DoTick calls the OnTick() function on the interface, if possible -func DoTick(t TickableIntf) error { +func DoTick(t Tickable) error { if t != nil { return t.OnTick() } diff --git a/player/tracker.go b/player/tracker.go index 6f32d8b..8c667bb 100644 --- a/player/tracker.go +++ b/player/tracker.go @@ -17,17 +17,17 @@ import ( "github.com/gotracker/playback/player/sampler" ) -// GetPremixDataIntf is an interface to getting the premix data from the tracker -type GetPremixDataIntf interface { +// Premixable is an interface to getting the premix data from the tracker +type Premixable interface { GetPremixData() (*device.PremixData, error) } // Tracker is an extensible music tracker type Tracker struct { BaseClockRate period.Frequency - Tickable TickableIntf - Premixable GetPremixDataIntf - Traceable TraceableIntf + Tickable Tickable + Premixable Premixable + Traceable Traceable s *sampler.Sampler opl2 render.OPL2Chip diff --git a/player/tracker_tracing.go b/player/tracker_tracing.go index c832f22..8f1e869 100644 --- a/player/tracker_tracing.go +++ b/player/tracker_tracing.go @@ -108,7 +108,7 @@ func (tt TracingTable) Fprintln(w io.Writer, colSep string, withRowNums bool) er return nil } -type TraceableIntf interface { +type Traceable interface { OutputTraces(out chan<- func(w io.Writer)) } diff --git a/player/voice/opl2.go b/player/voice/opl2.go index 0aee28d..434783b 100644 --- a/player/voice/opl2.go +++ b/player/voice/opl2.go @@ -34,7 +34,7 @@ type OPLConfiguration struct { InitialVolume volume.Volume InitialPeriod period.Period AutoVibrato voice.AutoVibrato - DataIntf instrument.DataIntf + Data instrument.Data } // == the actual opl2 voice == @@ -67,7 +67,7 @@ func NewOPL2(config OPLConfiguration) voice.Voice { var regs component.OPL2Registers - switch d := config.DataIntf.(type) { + switch d := config.Data.(type) { case *instrument.OPL2: v.amp.Setup(1) v.amp.ResetFadeoutValue(0) diff --git a/player/voice/pcm.go b/player/voice/pcm.go index b2360c5..9aa290f 100644 --- a/player/voice/pcm.go +++ b/player/voice/pcm.go @@ -35,7 +35,7 @@ type PCMConfiguration struct { InitialVolume volume.Volume InitialPeriod period.Period AutoVibrato voice.AutoVibrato - DataIntf instrument.DataIntf + Data instrument.Data OutputFilter voice.FilterApplier VoiceFilter filter.Filter PluginFilter filter.Filter @@ -82,7 +82,7 @@ func NewPCM(config PCMConfiguration) voice.Voice { active: true, } - switch d := config.DataIntf.(type) { + switch d := config.Data.(type) { case *instrument.PCM: v.pitchAndFilterEnvShared = true v.filterEnvActive = d.PitchFiltMode diff --git a/player/voice/voice.go b/player/voice/voice.go index ea352df..191d448 100644 --- a/player/voice/voice.go +++ b/player/voice/voice.go @@ -26,7 +26,7 @@ func New(inst *instrument.Instrument, output *output.Channel) voice.Voice { C2SPD: inst.GetC2Spd(), InitialVolume: inst.GetDefaultVolume(), AutoVibrato: inst.GetAutoVibrato(), - DataIntf: data, + Data: data, OutputFilter: output, VoiceFilter: voiceFilter, PluginFilter: pluginFilter, @@ -38,7 +38,7 @@ func New(inst *instrument.Instrument, output *output.Channel) voice.Voice { C2SPD: inst.GetC2Spd(), InitialVolume: inst.GetDefaultVolume(), AutoVibrato: inst.GetAutoVibrato(), - DataIntf: data, + Data: data, }) } return nil From 32971f6be322939873d43e0916a7beeb0b4e0221 Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 21:54:08 -0700 Subject: [PATCH 5/6] Further cleanup of packages --- format/it/{playback => }/effect/effect_arpeggio.go | 0 format/it/{playback => }/effect/effect_channelvolumeslide.go | 0 format/it/{playback => }/effect/effect_extrafineportadown.go | 0 format/it/{playback => }/effect/effect_extrafineportaup.go | 0 format/it/{playback => }/effect/effect_finepatterndelay.go | 2 +- format/it/{playback => }/effect/effect_fineportadown.go | 0 format/it/{playback => }/effect/effect_fineportaup.go | 0 format/it/{playback => }/effect/effect_finevibrato.go | 0 format/it/{playback => }/effect/effect_finevolslidedown.go | 0 format/it/{playback => }/effect/effect_finevolslideup.go | 0 format/it/{playback => }/effect/effect_globalvolumeslide.go | 2 +- format/it/{playback => }/effect/effect_highoffset.go | 0 .../{playback => }/effect/effect_newnoteactionnotecontinue.go | 0 format/it/{playback => }/effect/effect_newnoteactionnotecut.go | 0 format/it/{playback => }/effect/effect_newnoteactionnotefade.go | 0 format/it/{playback => }/effect/effect_newnoteactionnoteoff.go | 0 format/it/{playback => }/effect/effect_notecut.go | 0 format/it/{playback => }/effect/effect_notedelay.go | 0 format/it/{playback => }/effect/effect_orderjump.go | 0 format/it/{playback => }/effect/effect_panningenvelopeoff.go | 0 format/it/{playback => }/effect/effect_panningenvelopeon.go | 0 format/it/{playback => }/effect/effect_pastnotecut.go | 0 format/it/{playback => }/effect/effect_pastnotefadeout.go | 0 format/it/{playback => }/effect/effect_pastnoteoff.go | 0 format/it/{playback => }/effect/effect_patterndelay.go | 2 +- format/it/{playback => }/effect/effect_patternloop.go | 0 format/it/{playback => }/effect/effect_pitchenvelopeoff.go | 0 format/it/{playback => }/effect/effect_pitchenvelopeon.go | 0 format/it/{playback => }/effect/effect_portadown.go | 0 format/it/{playback => }/effect/effect_portatonote.go | 0 format/it/{playback => }/effect/effect_portaup.go | 0 format/it/{playback => }/effect/effect_portavolslide.go | 0 format/it/{playback => }/effect/effect_retrigvolslide.go | 0 format/it/{playback => }/effect/effect_rowjump.go | 0 format/it/{playback => }/effect/effect_sampleoffset.go | 0 format/it/{playback => }/effect/effect_setchannelvolume.go | 0 format/it/{playback => }/effect/effect_setcoarsepanposition.go | 0 format/it/{playback => }/effect/effect_setfinetune.go | 0 format/it/{playback => }/effect/effect_setglobalvolume.go | 0 format/it/{playback => }/effect/effect_setpanbrellowaveform.go | 0 format/it/{playback => }/effect/effect_setpanposition.go | 0 format/it/{playback => }/effect/effect_setspeed.go | 2 +- format/it/{playback => }/effect/effect_settempo.go | 2 +- format/it/{playback => }/effect/effect_settremolowaveform.go | 0 format/it/{playback => }/effect/effect_setvibratowaveform.go | 0 format/it/{playback => }/effect/effect_tremolo.go | 0 format/it/{playback => }/effect/effect_tremor.go | 0 format/it/{playback => }/effect/effect_vibrato.go | 0 format/it/{playback => }/effect/effect_vibratovolslide.go | 0 format/it/{playback => }/effect/effect_volslidedown.go | 0 format/it/{playback => }/effect/effect_volslideup.go | 0 format/it/{playback => }/effect/effect_volumeenvelopeoff.go | 0 format/it/{playback => }/effect/effect_volumeenvelopeon.go | 0 format/it/{playback => }/effect/effectfactory.go | 0 format/it/{playback => }/effect/effectfactory_volume.go | 0 format/it/{playback => }/effect/intf/intf.go | 0 format/it/{playback => }/effect/unhandled.go | 2 +- format/it/{playback => }/effect/util.go | 2 +- format/it/{playback => }/filter/resonantfilter.go | 0 format/it/load/instrument.go | 2 +- format/it/{playback/state => }/pattern/pattern.go | 0 format/it/playback/channeldata_transaction.go | 2 +- format/it/playback/playback.go | 2 +- format/s3m/{playback => }/effect/effect_arpeggio.go | 0 format/s3m/{playback => }/effect/effect_enablefilter.go | 2 +- format/s3m/{playback => }/effect/effect_extrafineportadown.go | 0 format/s3m/{playback => }/effect/effect_extrafineportaup.go | 0 format/s3m/{playback => }/effect/effect_finepatterndelay.go | 2 +- format/s3m/{playback => }/effect/effect_fineportadown.go | 0 format/s3m/{playback => }/effect/effect_fineportaup.go | 0 format/s3m/{playback => }/effect/effect_finevibrato.go | 0 format/s3m/{playback => }/effect/effect_finevolslidedown.go | 0 format/s3m/{playback => }/effect/effect_finevolslideup.go | 0 format/s3m/{playback => }/effect/effect_notecut.go | 0 format/s3m/{playback => }/effect/effect_notedelay.go | 0 format/s3m/{playback => }/effect/effect_orderjump.go | 0 format/s3m/{playback => }/effect/effect_patterndelay.go | 2 +- format/s3m/{playback => }/effect/effect_patternloop.go | 0 format/s3m/{playback => }/effect/effect_portadown.go | 0 format/s3m/{playback => }/effect/effect_portatonote.go | 0 format/s3m/{playback => }/effect/effect_portaup.go | 0 format/s3m/{playback => }/effect/effect_portavolslide.go | 0 format/s3m/{playback => }/effect/effect_retrigvolslide.go | 0 format/s3m/{playback => }/effect/effect_rowjump.go | 0 format/s3m/{playback => }/effect/effect_sampleoffset.go | 0 format/s3m/{playback => }/effect/effect_setfinetune.go | 0 format/s3m/{playback => }/effect/effect_setglobalvolume.go | 0 format/s3m/{playback => }/effect/effect_setpanposition.go | 0 format/s3m/{playback => }/effect/effect_setspeed.go | 2 +- format/s3m/{playback => }/effect/effect_settempo.go | 2 +- format/s3m/{playback => }/effect/effect_settremolowaveform.go | 0 format/s3m/{playback => }/effect/effect_setvibratowaveform.go | 0 format/s3m/{playback => }/effect/effect_stereocontrol.go | 0 format/s3m/{playback => }/effect/effect_tremolo.go | 0 format/s3m/{playback => }/effect/effect_tremor.go | 0 format/s3m/{playback => }/effect/effect_vibrato.go | 0 format/s3m/{playback => }/effect/effect_vibratovolslide.go | 0 format/s3m/{playback => }/effect/effect_volslidedown.go | 0 format/s3m/{playback => }/effect/effect_volslideup.go | 0 format/s3m/{playback => }/effect/effectfactory.go | 0 format/s3m/{playback => }/effect/intf/intf.go | 0 format/s3m/{playback => }/effect/unhandled.go | 2 +- format/s3m/{playback => }/effect/util.go | 0 format/s3m/{playback/state => }/pattern/pattern.go | 0 format/s3m/playback/channeldata_transaction.go | 2 +- format/s3m/playback/playback.go | 2 +- format/xm/{playback => }/effect/effect_arpeggio.go | 0 format/xm/{playback => }/effect/effect_extrafineportadown.go | 0 format/xm/{playback => }/effect/effect_extrafineportaup.go | 0 format/xm/{playback => }/effect/effect_fineportadown.go | 0 format/xm/{playback => }/effect/effect_fineportaup.go | 0 format/xm/{playback => }/effect/effect_finevolslidedown.go | 0 format/xm/{playback => }/effect/effect_finevolslideup.go | 0 format/xm/{playback => }/effect/effect_globalvolumeslide.go | 2 +- format/xm/{playback => }/effect/effect_notecut.go | 0 format/xm/{playback => }/effect/effect_notedelay.go | 0 format/xm/{playback => }/effect/effect_orderjump.go | 0 format/xm/{playback => }/effect/effect_panslide.go | 0 format/xm/{playback => }/effect/effect_patterndelay.go | 2 +- format/xm/{playback => }/effect/effect_patternloop.go | 0 format/xm/{playback => }/effect/effect_portadown.go | 0 format/xm/{playback => }/effect/effect_portatonote.go | 0 format/xm/{playback => }/effect/effect_portaup.go | 0 format/xm/{playback => }/effect/effect_portavolslide.go | 0 format/xm/{playback => }/effect/effect_retriggernote.go | 0 format/xm/{playback => }/effect/effect_retrigvolslide.go | 0 format/xm/{playback => }/effect/effect_rowjump.go | 0 format/xm/{playback => }/effect/effect_sampleoffset.go | 0 format/xm/{playback => }/effect/effect_setcoarsepanposition.go | 0 format/xm/{playback => }/effect/effect_setenvelopeposition.go | 0 format/xm/{playback => }/effect/effect_setfinetune.go | 0 format/xm/{playback => }/effect/effect_setglobalvolume.go | 0 format/xm/{playback => }/effect/effect_setpanposition.go | 0 format/xm/{playback => }/effect/effect_setspeed.go | 2 +- format/xm/{playback => }/effect/effect_settempo.go | 2 +- format/xm/{playback => }/effect/effect_settremolowaveform.go | 0 format/xm/{playback => }/effect/effect_setvibratowaveform.go | 0 format/xm/{playback => }/effect/effect_setvolume.go | 0 format/xm/{playback => }/effect/effect_tremolo.go | 0 format/xm/{playback => }/effect/effect_tremor.go | 0 format/xm/{playback => }/effect/effect_vibrato.go | 0 format/xm/{playback => }/effect/effect_vibratovolslide.go | 0 format/xm/{playback => }/effect/effect_volslide.go | 0 format/xm/{playback => }/effect/effectfactory.go | 0 format/xm/{playback => }/effect/effectfactory_standard.go | 0 format/xm/{playback => }/effect/effectfactory_volume.go | 0 format/xm/{playback => }/effect/intf/intf.go | 0 format/xm/{playback => }/effect/unhandled.go | 2 +- format/xm/{playback => }/effect/util.go | 2 +- format/xm/{playback/state => }/pattern/pattern.go | 0 format/xm/playback/channeldata_transaction.go | 2 +- format/xm/playback/playback.go | 2 +- 152 files changed, 26 insertions(+), 26 deletions(-) rename format/it/{playback => }/effect/effect_arpeggio.go (100%) rename format/it/{playback => }/effect/effect_channelvolumeslide.go (100%) rename format/it/{playback => }/effect/effect_extrafineportadown.go (100%) rename format/it/{playback => }/effect/effect_extrafineportaup.go (100%) rename format/it/{playback => }/effect/effect_finepatterndelay.go (90%) rename format/it/{playback => }/effect/effect_fineportadown.go (100%) rename format/it/{playback => }/effect/effect_fineportaup.go (100%) rename format/it/{playback => }/effect/effect_finevibrato.go (100%) rename format/it/{playback => }/effect/effect_finevolslidedown.go (100%) rename format/it/{playback => }/effect/effect_finevolslideup.go (100%) rename format/it/{playback => }/effect/effect_globalvolumeslide.go (93%) rename format/it/{playback => }/effect/effect_highoffset.go (100%) rename format/it/{playback => }/effect/effect_newnoteactionnotecontinue.go (100%) rename format/it/{playback => }/effect/effect_newnoteactionnotecut.go (100%) rename format/it/{playback => }/effect/effect_newnoteactionnotefade.go (100%) rename format/it/{playback => }/effect/effect_newnoteactionnoteoff.go (100%) rename format/it/{playback => }/effect/effect_notecut.go (100%) rename format/it/{playback => }/effect/effect_notedelay.go (100%) rename format/it/{playback => }/effect/effect_orderjump.go (100%) rename format/it/{playback => }/effect/effect_panningenvelopeoff.go (100%) rename format/it/{playback => }/effect/effect_panningenvelopeon.go (100%) rename format/it/{playback => }/effect/effect_pastnotecut.go (100%) rename format/it/{playback => }/effect/effect_pastnotefadeout.go (100%) rename format/it/{playback => }/effect/effect_pastnoteoff.go (100%) rename format/it/{playback => }/effect/effect_patterndelay.go (91%) rename format/it/{playback => }/effect/effect_patternloop.go (100%) rename format/it/{playback => }/effect/effect_pitchenvelopeoff.go (100%) rename format/it/{playback => }/effect/effect_pitchenvelopeon.go (100%) rename format/it/{playback => }/effect/effect_portadown.go (100%) rename format/it/{playback => }/effect/effect_portatonote.go (100%) rename format/it/{playback => }/effect/effect_portaup.go (100%) rename format/it/{playback => }/effect/effect_portavolslide.go (100%) rename format/it/{playback => }/effect/effect_retrigvolslide.go (100%) rename format/it/{playback => }/effect/effect_rowjump.go (100%) rename format/it/{playback => }/effect/effect_sampleoffset.go (100%) rename format/it/{playback => }/effect/effect_setchannelvolume.go (100%) rename format/it/{playback => }/effect/effect_setcoarsepanposition.go (100%) rename format/it/{playback => }/effect/effect_setfinetune.go (100%) rename format/it/{playback => }/effect/effect_setglobalvolume.go (100%) rename format/it/{playback => }/effect/effect_setpanbrellowaveform.go (100%) rename format/it/{playback => }/effect/effect_setpanposition.go (100%) rename format/it/{playback => }/effect/effect_setspeed.go (91%) rename format/it/{playback => }/effect/effect_settempo.go (95%) rename format/it/{playback => }/effect/effect_settremolowaveform.go (100%) rename format/it/{playback => }/effect/effect_setvibratowaveform.go (100%) rename format/it/{playback => }/effect/effect_tremolo.go (100%) rename format/it/{playback => }/effect/effect_tremor.go (100%) rename format/it/{playback => }/effect/effect_vibrato.go (100%) rename format/it/{playback => }/effect/effect_vibratovolslide.go (100%) rename format/it/{playback => }/effect/effect_volslidedown.go (100%) rename format/it/{playback => }/effect/effect_volslideup.go (100%) rename format/it/{playback => }/effect/effect_volumeenvelopeoff.go (100%) rename format/it/{playback => }/effect/effect_volumeenvelopeon.go (100%) rename format/it/{playback => }/effect/effectfactory.go (100%) rename format/it/{playback => }/effect/effectfactory_volume.go (100%) rename format/it/{playback => }/effect/intf/intf.go (100%) rename format/it/{playback => }/effect/unhandled.go (94%) rename format/it/{playback => }/effect/util.go (98%) rename format/it/{playback => }/filter/resonantfilter.go (100%) rename format/it/{playback/state => }/pattern/pattern.go (100%) rename format/s3m/{playback => }/effect/effect_arpeggio.go (100%) rename format/s3m/{playback => }/effect/effect_enablefilter.go (89%) rename format/s3m/{playback => }/effect/effect_extrafineportadown.go (100%) rename format/s3m/{playback => }/effect/effect_extrafineportaup.go (100%) rename format/s3m/{playback => }/effect/effect_finepatterndelay.go (89%) rename format/s3m/{playback => }/effect/effect_fineportadown.go (100%) rename format/s3m/{playback => }/effect/effect_fineportaup.go (100%) rename format/s3m/{playback => }/effect/effect_finevibrato.go (100%) rename format/s3m/{playback => }/effect/effect_finevolslidedown.go (100%) rename format/s3m/{playback => }/effect/effect_finevolslideup.go (100%) rename format/s3m/{playback => }/effect/effect_notecut.go (100%) rename format/s3m/{playback => }/effect/effect_notedelay.go (100%) rename format/s3m/{playback => }/effect/effect_orderjump.go (100%) rename format/s3m/{playback => }/effect/effect_patterndelay.go (91%) rename format/s3m/{playback => }/effect/effect_patternloop.go (100%) rename format/s3m/{playback => }/effect/effect_portadown.go (100%) rename format/s3m/{playback => }/effect/effect_portatonote.go (100%) rename format/s3m/{playback => }/effect/effect_portaup.go (100%) rename format/s3m/{playback => }/effect/effect_portavolslide.go (100%) rename format/s3m/{playback => }/effect/effect_retrigvolslide.go (100%) rename format/s3m/{playback => }/effect/effect_rowjump.go (100%) rename format/s3m/{playback => }/effect/effect_sampleoffset.go (100%) rename format/s3m/{playback => }/effect/effect_setfinetune.go (100%) rename format/s3m/{playback => }/effect/effect_setglobalvolume.go (100%) rename format/s3m/{playback => }/effect/effect_setpanposition.go (100%) rename format/s3m/{playback => }/effect/effect_setspeed.go (91%) rename format/s3m/{playback => }/effect/effect_settempo.go (95%) rename format/s3m/{playback => }/effect/effect_settremolowaveform.go (100%) rename format/s3m/{playback => }/effect/effect_setvibratowaveform.go (100%) rename format/s3m/{playback => }/effect/effect_stereocontrol.go (100%) rename format/s3m/{playback => }/effect/effect_tremolo.go (100%) rename format/s3m/{playback => }/effect/effect_tremor.go (100%) rename format/s3m/{playback => }/effect/effect_vibrato.go (100%) rename format/s3m/{playback => }/effect/effect_vibratovolslide.go (100%) rename format/s3m/{playback => }/effect/effect_volslidedown.go (100%) rename format/s3m/{playback => }/effect/effect_volslideup.go (100%) rename format/s3m/{playback => }/effect/effectfactory.go (100%) rename format/s3m/{playback => }/effect/intf/intf.go (100%) rename format/s3m/{playback => }/effect/unhandled.go (88%) rename format/s3m/{playback => }/effect/util.go (100%) rename format/s3m/{playback/state => }/pattern/pattern.go (100%) rename format/xm/{playback => }/effect/effect_arpeggio.go (100%) rename format/xm/{playback => }/effect/effect_extrafineportadown.go (100%) rename format/xm/{playback => }/effect/effect_extrafineportaup.go (100%) rename format/xm/{playback => }/effect/effect_fineportadown.go (100%) rename format/xm/{playback => }/effect/effect_fineportaup.go (100%) rename format/xm/{playback => }/effect/effect_finevolslidedown.go (100%) rename format/xm/{playback => }/effect/effect_finevolslideup.go (100%) rename format/xm/{playback => }/effect/effect_globalvolumeslide.go (93%) rename format/xm/{playback => }/effect/effect_notecut.go (100%) rename format/xm/{playback => }/effect/effect_notedelay.go (100%) rename format/xm/{playback => }/effect/effect_orderjump.go (100%) rename format/xm/{playback => }/effect/effect_panslide.go (100%) rename format/xm/{playback => }/effect/effect_patterndelay.go (91%) rename format/xm/{playback => }/effect/effect_patternloop.go (100%) rename format/xm/{playback => }/effect/effect_portadown.go (100%) rename format/xm/{playback => }/effect/effect_portatonote.go (100%) rename format/xm/{playback => }/effect/effect_portaup.go (100%) rename format/xm/{playback => }/effect/effect_portavolslide.go (100%) rename format/xm/{playback => }/effect/effect_retriggernote.go (100%) rename format/xm/{playback => }/effect/effect_retrigvolslide.go (100%) rename format/xm/{playback => }/effect/effect_rowjump.go (100%) rename format/xm/{playback => }/effect/effect_sampleoffset.go (100%) rename format/xm/{playback => }/effect/effect_setcoarsepanposition.go (100%) rename format/xm/{playback => }/effect/effect_setenvelopeposition.go (100%) rename format/xm/{playback => }/effect/effect_setfinetune.go (100%) rename format/xm/{playback => }/effect/effect_setglobalvolume.go (100%) rename format/xm/{playback => }/effect/effect_setpanposition.go (100%) rename format/xm/{playback => }/effect/effect_setspeed.go (91%) rename format/xm/{playback => }/effect/effect_settempo.go (93%) rename format/xm/{playback => }/effect/effect_settremolowaveform.go (100%) rename format/xm/{playback => }/effect/effect_setvibratowaveform.go (100%) rename format/xm/{playback => }/effect/effect_setvolume.go (100%) rename format/xm/{playback => }/effect/effect_tremolo.go (100%) rename format/xm/{playback => }/effect/effect_tremor.go (100%) rename format/xm/{playback => }/effect/effect_vibrato.go (100%) rename format/xm/{playback => }/effect/effect_vibratovolslide.go (100%) rename format/xm/{playback => }/effect/effect_volslide.go (100%) rename format/xm/{playback => }/effect/effectfactory.go (100%) rename format/xm/{playback => }/effect/effectfactory_standard.go (100%) rename format/xm/{playback => }/effect/effectfactory_volume.go (100%) rename format/xm/{playback => }/effect/intf/intf.go (100%) rename format/xm/{playback => }/effect/unhandled.go (94%) rename format/xm/{playback => }/effect/util.go (98%) rename format/xm/{playback/state => }/pattern/pattern.go (100%) diff --git a/format/it/playback/effect/effect_arpeggio.go b/format/it/effect/effect_arpeggio.go similarity index 100% rename from format/it/playback/effect/effect_arpeggio.go rename to format/it/effect/effect_arpeggio.go diff --git a/format/it/playback/effect/effect_channelvolumeslide.go b/format/it/effect/effect_channelvolumeslide.go similarity index 100% rename from format/it/playback/effect/effect_channelvolumeslide.go rename to format/it/effect/effect_channelvolumeslide.go diff --git a/format/it/playback/effect/effect_extrafineportadown.go b/format/it/effect/effect_extrafineportadown.go similarity index 100% rename from format/it/playback/effect/effect_extrafineportadown.go rename to format/it/effect/effect_extrafineportadown.go diff --git a/format/it/playback/effect/effect_extrafineportaup.go b/format/it/effect/effect_extrafineportaup.go similarity index 100% rename from format/it/playback/effect/effect_extrafineportaup.go rename to format/it/effect/effect_extrafineportaup.go diff --git a/format/it/playback/effect/effect_finepatterndelay.go b/format/it/effect/effect_finepatterndelay.go similarity index 90% rename from format/it/playback/effect/effect_finepatterndelay.go rename to format/it/effect/effect_finepatterndelay.go index b8855e4..da66c76 100644 --- a/format/it/playback/effect/effect_finepatterndelay.go +++ b/format/it/effect/effect_finepatterndelay.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // FinePatternDelay defines an fine pattern delay effect diff --git a/format/it/playback/effect/effect_fineportadown.go b/format/it/effect/effect_fineportadown.go similarity index 100% rename from format/it/playback/effect/effect_fineportadown.go rename to format/it/effect/effect_fineportadown.go diff --git a/format/it/playback/effect/effect_fineportaup.go b/format/it/effect/effect_fineportaup.go similarity index 100% rename from format/it/playback/effect/effect_fineportaup.go rename to format/it/effect/effect_fineportaup.go diff --git a/format/it/playback/effect/effect_finevibrato.go b/format/it/effect/effect_finevibrato.go similarity index 100% rename from format/it/playback/effect/effect_finevibrato.go rename to format/it/effect/effect_finevibrato.go diff --git a/format/it/playback/effect/effect_finevolslidedown.go b/format/it/effect/effect_finevolslidedown.go similarity index 100% rename from format/it/playback/effect/effect_finevolslidedown.go rename to format/it/effect/effect_finevolslidedown.go diff --git a/format/it/playback/effect/effect_finevolslideup.go b/format/it/effect/effect_finevolslideup.go similarity index 100% rename from format/it/playback/effect/effect_finevolslideup.go rename to format/it/effect/effect_finevolslideup.go diff --git a/format/it/playback/effect/effect_globalvolumeslide.go b/format/it/effect/effect_globalvolumeslide.go similarity index 93% rename from format/it/playback/effect/effect_globalvolumeslide.go rename to format/it/effect/effect_globalvolumeslide.go index 1a984dc..b63bdf8 100644 --- a/format/it/playback/effect/effect_globalvolumeslide.go +++ b/format/it/effect/effect_globalvolumeslide.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // GlobalVolumeSlide defines a global volume slide effect diff --git a/format/it/playback/effect/effect_highoffset.go b/format/it/effect/effect_highoffset.go similarity index 100% rename from format/it/playback/effect/effect_highoffset.go rename to format/it/effect/effect_highoffset.go diff --git a/format/it/playback/effect/effect_newnoteactionnotecontinue.go b/format/it/effect/effect_newnoteactionnotecontinue.go similarity index 100% rename from format/it/playback/effect/effect_newnoteactionnotecontinue.go rename to format/it/effect/effect_newnoteactionnotecontinue.go diff --git a/format/it/playback/effect/effect_newnoteactionnotecut.go b/format/it/effect/effect_newnoteactionnotecut.go similarity index 100% rename from format/it/playback/effect/effect_newnoteactionnotecut.go rename to format/it/effect/effect_newnoteactionnotecut.go diff --git a/format/it/playback/effect/effect_newnoteactionnotefade.go b/format/it/effect/effect_newnoteactionnotefade.go similarity index 100% rename from format/it/playback/effect/effect_newnoteactionnotefade.go rename to format/it/effect/effect_newnoteactionnotefade.go diff --git a/format/it/playback/effect/effect_newnoteactionnoteoff.go b/format/it/effect/effect_newnoteactionnoteoff.go similarity index 100% rename from format/it/playback/effect/effect_newnoteactionnoteoff.go rename to format/it/effect/effect_newnoteactionnoteoff.go diff --git a/format/it/playback/effect/effect_notecut.go b/format/it/effect/effect_notecut.go similarity index 100% rename from format/it/playback/effect/effect_notecut.go rename to format/it/effect/effect_notecut.go diff --git a/format/it/playback/effect/effect_notedelay.go b/format/it/effect/effect_notedelay.go similarity index 100% rename from format/it/playback/effect/effect_notedelay.go rename to format/it/effect/effect_notedelay.go diff --git a/format/it/playback/effect/effect_orderjump.go b/format/it/effect/effect_orderjump.go similarity index 100% rename from format/it/playback/effect/effect_orderjump.go rename to format/it/effect/effect_orderjump.go diff --git a/format/it/playback/effect/effect_panningenvelopeoff.go b/format/it/effect/effect_panningenvelopeoff.go similarity index 100% rename from format/it/playback/effect/effect_panningenvelopeoff.go rename to format/it/effect/effect_panningenvelopeoff.go diff --git a/format/it/playback/effect/effect_panningenvelopeon.go b/format/it/effect/effect_panningenvelopeon.go similarity index 100% rename from format/it/playback/effect/effect_panningenvelopeon.go rename to format/it/effect/effect_panningenvelopeon.go diff --git a/format/it/playback/effect/effect_pastnotecut.go b/format/it/effect/effect_pastnotecut.go similarity index 100% rename from format/it/playback/effect/effect_pastnotecut.go rename to format/it/effect/effect_pastnotecut.go diff --git a/format/it/playback/effect/effect_pastnotefadeout.go b/format/it/effect/effect_pastnotefadeout.go similarity index 100% rename from format/it/playback/effect/effect_pastnotefadeout.go rename to format/it/effect/effect_pastnotefadeout.go diff --git a/format/it/playback/effect/effect_pastnoteoff.go b/format/it/effect/effect_pastnoteoff.go similarity index 100% rename from format/it/playback/effect/effect_pastnoteoff.go rename to format/it/effect/effect_pastnoteoff.go diff --git a/format/it/playback/effect/effect_patterndelay.go b/format/it/effect/effect_patterndelay.go similarity index 91% rename from format/it/playback/effect/effect_patterndelay.go rename to format/it/effect/effect_patterndelay.go index 1a21346..491cb47 100644 --- a/format/it/playback/effect/effect_patterndelay.go +++ b/format/it/effect/effect_patterndelay.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // PatternDelay defines a pattern delay effect diff --git a/format/it/playback/effect/effect_patternloop.go b/format/it/effect/effect_patternloop.go similarity index 100% rename from format/it/playback/effect/effect_patternloop.go rename to format/it/effect/effect_patternloop.go diff --git a/format/it/playback/effect/effect_pitchenvelopeoff.go b/format/it/effect/effect_pitchenvelopeoff.go similarity index 100% rename from format/it/playback/effect/effect_pitchenvelopeoff.go rename to format/it/effect/effect_pitchenvelopeoff.go diff --git a/format/it/playback/effect/effect_pitchenvelopeon.go b/format/it/effect/effect_pitchenvelopeon.go similarity index 100% rename from format/it/playback/effect/effect_pitchenvelopeon.go rename to format/it/effect/effect_pitchenvelopeon.go diff --git a/format/it/playback/effect/effect_portadown.go b/format/it/effect/effect_portadown.go similarity index 100% rename from format/it/playback/effect/effect_portadown.go rename to format/it/effect/effect_portadown.go diff --git a/format/it/playback/effect/effect_portatonote.go b/format/it/effect/effect_portatonote.go similarity index 100% rename from format/it/playback/effect/effect_portatonote.go rename to format/it/effect/effect_portatonote.go diff --git a/format/it/playback/effect/effect_portaup.go b/format/it/effect/effect_portaup.go similarity index 100% rename from format/it/playback/effect/effect_portaup.go rename to format/it/effect/effect_portaup.go diff --git a/format/it/playback/effect/effect_portavolslide.go b/format/it/effect/effect_portavolslide.go similarity index 100% rename from format/it/playback/effect/effect_portavolslide.go rename to format/it/effect/effect_portavolslide.go diff --git a/format/it/playback/effect/effect_retrigvolslide.go b/format/it/effect/effect_retrigvolslide.go similarity index 100% rename from format/it/playback/effect/effect_retrigvolslide.go rename to format/it/effect/effect_retrigvolslide.go diff --git a/format/it/playback/effect/effect_rowjump.go b/format/it/effect/effect_rowjump.go similarity index 100% rename from format/it/playback/effect/effect_rowjump.go rename to format/it/effect/effect_rowjump.go diff --git a/format/it/playback/effect/effect_sampleoffset.go b/format/it/effect/effect_sampleoffset.go similarity index 100% rename from format/it/playback/effect/effect_sampleoffset.go rename to format/it/effect/effect_sampleoffset.go diff --git a/format/it/playback/effect/effect_setchannelvolume.go b/format/it/effect/effect_setchannelvolume.go similarity index 100% rename from format/it/playback/effect/effect_setchannelvolume.go rename to format/it/effect/effect_setchannelvolume.go diff --git a/format/it/playback/effect/effect_setcoarsepanposition.go b/format/it/effect/effect_setcoarsepanposition.go similarity index 100% rename from format/it/playback/effect/effect_setcoarsepanposition.go rename to format/it/effect/effect_setcoarsepanposition.go diff --git a/format/it/playback/effect/effect_setfinetune.go b/format/it/effect/effect_setfinetune.go similarity index 100% rename from format/it/playback/effect/effect_setfinetune.go rename to format/it/effect/effect_setfinetune.go diff --git a/format/it/playback/effect/effect_setglobalvolume.go b/format/it/effect/effect_setglobalvolume.go similarity index 100% rename from format/it/playback/effect/effect_setglobalvolume.go rename to format/it/effect/effect_setglobalvolume.go diff --git a/format/it/playback/effect/effect_setpanbrellowaveform.go b/format/it/effect/effect_setpanbrellowaveform.go similarity index 100% rename from format/it/playback/effect/effect_setpanbrellowaveform.go rename to format/it/effect/effect_setpanbrellowaveform.go diff --git a/format/it/playback/effect/effect_setpanposition.go b/format/it/effect/effect_setpanposition.go similarity index 100% rename from format/it/playback/effect/effect_setpanposition.go rename to format/it/effect/effect_setpanposition.go diff --git a/format/it/playback/effect/effect_setspeed.go b/format/it/effect/effect_setspeed.go similarity index 91% rename from format/it/playback/effect/effect_setspeed.go rename to format/it/effect/effect_setspeed.go index 0a650e2..7c8258c 100644 --- a/format/it/playback/effect/effect_setspeed.go +++ b/format/it/effect/effect_setspeed.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // SetSpeed defines a set speed effect diff --git a/format/it/playback/effect/effect_settempo.go b/format/it/effect/effect_settempo.go similarity index 95% rename from format/it/playback/effect/effect_settempo.go rename to format/it/effect/effect_settempo.go index 93d36ca..ff82142 100644 --- a/format/it/playback/effect/effect_settempo.go +++ b/format/it/effect/effect_settempo.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // SetTempo defines a set tempo effect diff --git a/format/it/playback/effect/effect_settremolowaveform.go b/format/it/effect/effect_settremolowaveform.go similarity index 100% rename from format/it/playback/effect/effect_settremolowaveform.go rename to format/it/effect/effect_settremolowaveform.go diff --git a/format/it/playback/effect/effect_setvibratowaveform.go b/format/it/effect/effect_setvibratowaveform.go similarity index 100% rename from format/it/playback/effect/effect_setvibratowaveform.go rename to format/it/effect/effect_setvibratowaveform.go diff --git a/format/it/playback/effect/effect_tremolo.go b/format/it/effect/effect_tremolo.go similarity index 100% rename from format/it/playback/effect/effect_tremolo.go rename to format/it/effect/effect_tremolo.go diff --git a/format/it/playback/effect/effect_tremor.go b/format/it/effect/effect_tremor.go similarity index 100% rename from format/it/playback/effect/effect_tremor.go rename to format/it/effect/effect_tremor.go diff --git a/format/it/playback/effect/effect_vibrato.go b/format/it/effect/effect_vibrato.go similarity index 100% rename from format/it/playback/effect/effect_vibrato.go rename to format/it/effect/effect_vibrato.go diff --git a/format/it/playback/effect/effect_vibratovolslide.go b/format/it/effect/effect_vibratovolslide.go similarity index 100% rename from format/it/playback/effect/effect_vibratovolslide.go rename to format/it/effect/effect_vibratovolslide.go diff --git a/format/it/playback/effect/effect_volslidedown.go b/format/it/effect/effect_volslidedown.go similarity index 100% rename from format/it/playback/effect/effect_volslidedown.go rename to format/it/effect/effect_volslidedown.go diff --git a/format/it/playback/effect/effect_volslideup.go b/format/it/effect/effect_volslideup.go similarity index 100% rename from format/it/playback/effect/effect_volslideup.go rename to format/it/effect/effect_volslideup.go diff --git a/format/it/playback/effect/effect_volumeenvelopeoff.go b/format/it/effect/effect_volumeenvelopeoff.go similarity index 100% rename from format/it/playback/effect/effect_volumeenvelopeoff.go rename to format/it/effect/effect_volumeenvelopeoff.go diff --git a/format/it/playback/effect/effect_volumeenvelopeon.go b/format/it/effect/effect_volumeenvelopeon.go similarity index 100% rename from format/it/playback/effect/effect_volumeenvelopeon.go rename to format/it/effect/effect_volumeenvelopeon.go diff --git a/format/it/playback/effect/effectfactory.go b/format/it/effect/effectfactory.go similarity index 100% rename from format/it/playback/effect/effectfactory.go rename to format/it/effect/effectfactory.go diff --git a/format/it/playback/effect/effectfactory_volume.go b/format/it/effect/effectfactory_volume.go similarity index 100% rename from format/it/playback/effect/effectfactory_volume.go rename to format/it/effect/effectfactory_volume.go diff --git a/format/it/playback/effect/intf/intf.go b/format/it/effect/intf/intf.go similarity index 100% rename from format/it/playback/effect/intf/intf.go rename to format/it/effect/intf/intf.go diff --git a/format/it/playback/effect/unhandled.go b/format/it/effect/unhandled.go similarity index 94% rename from format/it/playback/effect/unhandled.go rename to format/it/effect/unhandled.go index d1dc7c1..4166ac7 100644 --- a/format/it/playback/effect/unhandled.go +++ b/format/it/effect/unhandled.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" ) // UnhandledCommand is an unhandled command diff --git a/format/it/playback/effect/util.go b/format/it/effect/util.go similarity index 98% rename from format/it/playback/effect/util.go rename to format/it/effect/util.go index aa3a5e3..e542375 100644 --- a/format/it/playback/effect/util.go +++ b/format/it/effect/util.go @@ -7,7 +7,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - effectIntf "github.com/gotracker/playback/format/it/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/it/effect/intf" itVolume "github.com/gotracker/playback/format/it/volume" "github.com/gotracker/playback/note" "github.com/heucuva/comparison" diff --git a/format/it/playback/filter/resonantfilter.go b/format/it/filter/resonantfilter.go similarity index 100% rename from format/it/playback/filter/resonantfilter.go rename to format/it/filter/resonantfilter.go diff --git a/format/it/load/instrument.go b/format/it/load/instrument.go index b6d342b..70e2d58 100644 --- a/format/it/load/instrument.go +++ b/format/it/load/instrument.go @@ -20,8 +20,8 @@ import ( "github.com/gotracker/playback/voice/pcm" "github.com/gotracker/playback/filter" + itfilter "github.com/gotracker/playback/format/it/filter" itNote "github.com/gotracker/playback/format/it/note" - itfilter "github.com/gotracker/playback/format/it/playback/filter" "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/note" oscillatorImpl "github.com/gotracker/playback/oscillator" diff --git a/format/it/playback/state/pattern/pattern.go b/format/it/pattern/pattern.go similarity index 100% rename from format/it/playback/state/pattern/pattern.go rename to format/it/pattern/pattern.go diff --git a/format/it/playback/channeldata_transaction.go b/format/it/playback/channeldata_transaction.go index e387c61..d1e44a1 100644 --- a/format/it/playback/channeldata_transaction.go +++ b/format/it/playback/channeldata_transaction.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback" "github.com/gotracker/playback/format/it/channel" - "github.com/gotracker/playback/format/it/playback/effect" + "github.com/gotracker/playback/format/it/effect" "github.com/gotracker/playback/note" "github.com/gotracker/playback/player/state" "github.com/gotracker/playback/song" diff --git a/format/it/playback/playback.go b/format/it/playback/playback.go index 2593d06..33764ef 100644 --- a/format/it/playback/playback.go +++ b/format/it/playback/playback.go @@ -8,8 +8,8 @@ import ( "github.com/gotracker/playback/format/it/channel" itFeature "github.com/gotracker/playback/format/it/feature" "github.com/gotracker/playback/format/it/layout" + "github.com/gotracker/playback/format/it/pattern" itPeriod "github.com/gotracker/playback/format/it/period" - "github.com/gotracker/playback/format/it/playback/state/pattern" "github.com/gotracker/playback/index" "github.com/gotracker/playback/note" playpattern "github.com/gotracker/playback/pattern" diff --git a/format/s3m/playback/effect/effect_arpeggio.go b/format/s3m/effect/effect_arpeggio.go similarity index 100% rename from format/s3m/playback/effect/effect_arpeggio.go rename to format/s3m/effect/effect_arpeggio.go diff --git a/format/s3m/playback/effect/effect_enablefilter.go b/format/s3m/effect/effect_enablefilter.go similarity index 89% rename from format/s3m/playback/effect/effect_enablefilter.go rename to format/s3m/effect/effect_enablefilter.go index dda4021..5933722 100644 --- a/format/s3m/playback/effect/effect_enablefilter.go +++ b/format/s3m/effect/effect_enablefilter.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // EnableFilter defines a set filter enable effect diff --git a/format/s3m/playback/effect/effect_extrafineportadown.go b/format/s3m/effect/effect_extrafineportadown.go similarity index 100% rename from format/s3m/playback/effect/effect_extrafineportadown.go rename to format/s3m/effect/effect_extrafineportadown.go diff --git a/format/s3m/playback/effect/effect_extrafineportaup.go b/format/s3m/effect/effect_extrafineportaup.go similarity index 100% rename from format/s3m/playback/effect/effect_extrafineportaup.go rename to format/s3m/effect/effect_extrafineportaup.go diff --git a/format/s3m/playback/effect/effect_finepatterndelay.go b/format/s3m/effect/effect_finepatterndelay.go similarity index 89% rename from format/s3m/playback/effect/effect_finepatterndelay.go rename to format/s3m/effect/effect_finepatterndelay.go index 4bb2214..ad80702 100644 --- a/format/s3m/playback/effect/effect_finepatterndelay.go +++ b/format/s3m/effect/effect_finepatterndelay.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // FinePatternDelay defines an fine pattern delay effect diff --git a/format/s3m/playback/effect/effect_fineportadown.go b/format/s3m/effect/effect_fineportadown.go similarity index 100% rename from format/s3m/playback/effect/effect_fineportadown.go rename to format/s3m/effect/effect_fineportadown.go diff --git a/format/s3m/playback/effect/effect_fineportaup.go b/format/s3m/effect/effect_fineportaup.go similarity index 100% rename from format/s3m/playback/effect/effect_fineportaup.go rename to format/s3m/effect/effect_fineportaup.go diff --git a/format/s3m/playback/effect/effect_finevibrato.go b/format/s3m/effect/effect_finevibrato.go similarity index 100% rename from format/s3m/playback/effect/effect_finevibrato.go rename to format/s3m/effect/effect_finevibrato.go diff --git a/format/s3m/playback/effect/effect_finevolslidedown.go b/format/s3m/effect/effect_finevolslidedown.go similarity index 100% rename from format/s3m/playback/effect/effect_finevolslidedown.go rename to format/s3m/effect/effect_finevolslidedown.go diff --git a/format/s3m/playback/effect/effect_finevolslideup.go b/format/s3m/effect/effect_finevolslideup.go similarity index 100% rename from format/s3m/playback/effect/effect_finevolslideup.go rename to format/s3m/effect/effect_finevolslideup.go diff --git a/format/s3m/playback/effect/effect_notecut.go b/format/s3m/effect/effect_notecut.go similarity index 100% rename from format/s3m/playback/effect/effect_notecut.go rename to format/s3m/effect/effect_notecut.go diff --git a/format/s3m/playback/effect/effect_notedelay.go b/format/s3m/effect/effect_notedelay.go similarity index 100% rename from format/s3m/playback/effect/effect_notedelay.go rename to format/s3m/effect/effect_notedelay.go diff --git a/format/s3m/playback/effect/effect_orderjump.go b/format/s3m/effect/effect_orderjump.go similarity index 100% rename from format/s3m/playback/effect/effect_orderjump.go rename to format/s3m/effect/effect_orderjump.go diff --git a/format/s3m/playback/effect/effect_patterndelay.go b/format/s3m/effect/effect_patterndelay.go similarity index 91% rename from format/s3m/playback/effect/effect_patterndelay.go rename to format/s3m/effect/effect_patterndelay.go index b311e43..3ebf8da 100644 --- a/format/s3m/playback/effect/effect_patterndelay.go +++ b/format/s3m/effect/effect_patterndelay.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // PatternDelay defines a pattern delay effect diff --git a/format/s3m/playback/effect/effect_patternloop.go b/format/s3m/effect/effect_patternloop.go similarity index 100% rename from format/s3m/playback/effect/effect_patternloop.go rename to format/s3m/effect/effect_patternloop.go diff --git a/format/s3m/playback/effect/effect_portadown.go b/format/s3m/effect/effect_portadown.go similarity index 100% rename from format/s3m/playback/effect/effect_portadown.go rename to format/s3m/effect/effect_portadown.go diff --git a/format/s3m/playback/effect/effect_portatonote.go b/format/s3m/effect/effect_portatonote.go similarity index 100% rename from format/s3m/playback/effect/effect_portatonote.go rename to format/s3m/effect/effect_portatonote.go diff --git a/format/s3m/playback/effect/effect_portaup.go b/format/s3m/effect/effect_portaup.go similarity index 100% rename from format/s3m/playback/effect/effect_portaup.go rename to format/s3m/effect/effect_portaup.go diff --git a/format/s3m/playback/effect/effect_portavolslide.go b/format/s3m/effect/effect_portavolslide.go similarity index 100% rename from format/s3m/playback/effect/effect_portavolslide.go rename to format/s3m/effect/effect_portavolslide.go diff --git a/format/s3m/playback/effect/effect_retrigvolslide.go b/format/s3m/effect/effect_retrigvolslide.go similarity index 100% rename from format/s3m/playback/effect/effect_retrigvolslide.go rename to format/s3m/effect/effect_retrigvolslide.go diff --git a/format/s3m/playback/effect/effect_rowjump.go b/format/s3m/effect/effect_rowjump.go similarity index 100% rename from format/s3m/playback/effect/effect_rowjump.go rename to format/s3m/effect/effect_rowjump.go diff --git a/format/s3m/playback/effect/effect_sampleoffset.go b/format/s3m/effect/effect_sampleoffset.go similarity index 100% rename from format/s3m/playback/effect/effect_sampleoffset.go rename to format/s3m/effect/effect_sampleoffset.go diff --git a/format/s3m/playback/effect/effect_setfinetune.go b/format/s3m/effect/effect_setfinetune.go similarity index 100% rename from format/s3m/playback/effect/effect_setfinetune.go rename to format/s3m/effect/effect_setfinetune.go diff --git a/format/s3m/playback/effect/effect_setglobalvolume.go b/format/s3m/effect/effect_setglobalvolume.go similarity index 100% rename from format/s3m/playback/effect/effect_setglobalvolume.go rename to format/s3m/effect/effect_setglobalvolume.go diff --git a/format/s3m/playback/effect/effect_setpanposition.go b/format/s3m/effect/effect_setpanposition.go similarity index 100% rename from format/s3m/playback/effect/effect_setpanposition.go rename to format/s3m/effect/effect_setpanposition.go diff --git a/format/s3m/playback/effect/effect_setspeed.go b/format/s3m/effect/effect_setspeed.go similarity index 91% rename from format/s3m/playback/effect/effect_setspeed.go rename to format/s3m/effect/effect_setspeed.go index 7afcb65..cc43bf5 100644 --- a/format/s3m/playback/effect/effect_setspeed.go +++ b/format/s3m/effect/effect_setspeed.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // SetSpeed defines a set speed effect diff --git a/format/s3m/playback/effect/effect_settempo.go b/format/s3m/effect/effect_settempo.go similarity index 95% rename from format/s3m/playback/effect/effect_settempo.go rename to format/s3m/effect/effect_settempo.go index fd58816..9567759 100644 --- a/format/s3m/playback/effect/effect_settempo.go +++ b/format/s3m/effect/effect_settempo.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // SetTempo defines a set tempo effect diff --git a/format/s3m/playback/effect/effect_settremolowaveform.go b/format/s3m/effect/effect_settremolowaveform.go similarity index 100% rename from format/s3m/playback/effect/effect_settremolowaveform.go rename to format/s3m/effect/effect_settremolowaveform.go diff --git a/format/s3m/playback/effect/effect_setvibratowaveform.go b/format/s3m/effect/effect_setvibratowaveform.go similarity index 100% rename from format/s3m/playback/effect/effect_setvibratowaveform.go rename to format/s3m/effect/effect_setvibratowaveform.go diff --git a/format/s3m/playback/effect/effect_stereocontrol.go b/format/s3m/effect/effect_stereocontrol.go similarity index 100% rename from format/s3m/playback/effect/effect_stereocontrol.go rename to format/s3m/effect/effect_stereocontrol.go diff --git a/format/s3m/playback/effect/effect_tremolo.go b/format/s3m/effect/effect_tremolo.go similarity index 100% rename from format/s3m/playback/effect/effect_tremolo.go rename to format/s3m/effect/effect_tremolo.go diff --git a/format/s3m/playback/effect/effect_tremor.go b/format/s3m/effect/effect_tremor.go similarity index 100% rename from format/s3m/playback/effect/effect_tremor.go rename to format/s3m/effect/effect_tremor.go diff --git a/format/s3m/playback/effect/effect_vibrato.go b/format/s3m/effect/effect_vibrato.go similarity index 100% rename from format/s3m/playback/effect/effect_vibrato.go rename to format/s3m/effect/effect_vibrato.go diff --git a/format/s3m/playback/effect/effect_vibratovolslide.go b/format/s3m/effect/effect_vibratovolslide.go similarity index 100% rename from format/s3m/playback/effect/effect_vibratovolslide.go rename to format/s3m/effect/effect_vibratovolslide.go diff --git a/format/s3m/playback/effect/effect_volslidedown.go b/format/s3m/effect/effect_volslidedown.go similarity index 100% rename from format/s3m/playback/effect/effect_volslidedown.go rename to format/s3m/effect/effect_volslidedown.go diff --git a/format/s3m/playback/effect/effect_volslideup.go b/format/s3m/effect/effect_volslideup.go similarity index 100% rename from format/s3m/playback/effect/effect_volslideup.go rename to format/s3m/effect/effect_volslideup.go diff --git a/format/s3m/playback/effect/effectfactory.go b/format/s3m/effect/effectfactory.go similarity index 100% rename from format/s3m/playback/effect/effectfactory.go rename to format/s3m/effect/effectfactory.go diff --git a/format/s3m/playback/effect/intf/intf.go b/format/s3m/effect/intf/intf.go similarity index 100% rename from format/s3m/playback/effect/intf/intf.go rename to format/s3m/effect/intf/intf.go diff --git a/format/s3m/playback/effect/unhandled.go b/format/s3m/effect/unhandled.go similarity index 88% rename from format/s3m/playback/effect/unhandled.go rename to format/s3m/effect/unhandled.go index 83d3bb8..2909bdd 100644 --- a/format/s3m/playback/effect/unhandled.go +++ b/format/s3m/effect/unhandled.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - effectIntf "github.com/gotracker/playback/format/s3m/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/s3m/effect/intf" ) // UnhandledCommand is an unhandled command diff --git a/format/s3m/playback/effect/util.go b/format/s3m/effect/util.go similarity index 100% rename from format/s3m/playback/effect/util.go rename to format/s3m/effect/util.go diff --git a/format/s3m/playback/state/pattern/pattern.go b/format/s3m/pattern/pattern.go similarity index 100% rename from format/s3m/playback/state/pattern/pattern.go rename to format/s3m/pattern/pattern.go diff --git a/format/s3m/playback/channeldata_transaction.go b/format/s3m/playback/channeldata_transaction.go index e10b078..283bb23 100644 --- a/format/s3m/playback/channeldata_transaction.go +++ b/format/s3m/playback/channeldata_transaction.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" - "github.com/gotracker/playback/format/s3m/playback/effect" + "github.com/gotracker/playback/format/s3m/effect" "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/note" "github.com/gotracker/playback/player/state" diff --git a/format/s3m/playback/playback.go b/format/s3m/playback/playback.go index a62f78f..aced919 100644 --- a/format/s3m/playback/playback.go +++ b/format/s3m/playback/playback.go @@ -9,8 +9,8 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/s3m/channel" "github.com/gotracker/playback/format/s3m/layout" + "github.com/gotracker/playback/format/s3m/pattern" s3mPeriod "github.com/gotracker/playback/format/s3m/period" - "github.com/gotracker/playback/format/s3m/playback/state/pattern" "github.com/gotracker/playback/index" "github.com/gotracker/playback/note" playpattern "github.com/gotracker/playback/pattern" diff --git a/format/xm/playback/effect/effect_arpeggio.go b/format/xm/effect/effect_arpeggio.go similarity index 100% rename from format/xm/playback/effect/effect_arpeggio.go rename to format/xm/effect/effect_arpeggio.go diff --git a/format/xm/playback/effect/effect_extrafineportadown.go b/format/xm/effect/effect_extrafineportadown.go similarity index 100% rename from format/xm/playback/effect/effect_extrafineportadown.go rename to format/xm/effect/effect_extrafineportadown.go diff --git a/format/xm/playback/effect/effect_extrafineportaup.go b/format/xm/effect/effect_extrafineportaup.go similarity index 100% rename from format/xm/playback/effect/effect_extrafineportaup.go rename to format/xm/effect/effect_extrafineportaup.go diff --git a/format/xm/playback/effect/effect_fineportadown.go b/format/xm/effect/effect_fineportadown.go similarity index 100% rename from format/xm/playback/effect/effect_fineportadown.go rename to format/xm/effect/effect_fineportadown.go diff --git a/format/xm/playback/effect/effect_fineportaup.go b/format/xm/effect/effect_fineportaup.go similarity index 100% rename from format/xm/playback/effect/effect_fineportaup.go rename to format/xm/effect/effect_fineportaup.go diff --git a/format/xm/playback/effect/effect_finevolslidedown.go b/format/xm/effect/effect_finevolslidedown.go similarity index 100% rename from format/xm/playback/effect/effect_finevolslidedown.go rename to format/xm/effect/effect_finevolslidedown.go diff --git a/format/xm/playback/effect/effect_finevolslideup.go b/format/xm/effect/effect_finevolslideup.go similarity index 100% rename from format/xm/playback/effect/effect_finevolslideup.go rename to format/xm/effect/effect_finevolslideup.go diff --git a/format/xm/playback/effect/effect_globalvolumeslide.go b/format/xm/effect/effect_globalvolumeslide.go similarity index 93% rename from format/xm/playback/effect/effect_globalvolumeslide.go rename to format/xm/effect/effect_globalvolumeslide.go index 67e1800..23c10ac 100644 --- a/format/xm/playback/effect/effect_globalvolumeslide.go +++ b/format/xm/effect/effect_globalvolumeslide.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" ) // GlobalVolumeSlide defines a global volume slide effect diff --git a/format/xm/playback/effect/effect_notecut.go b/format/xm/effect/effect_notecut.go similarity index 100% rename from format/xm/playback/effect/effect_notecut.go rename to format/xm/effect/effect_notecut.go diff --git a/format/xm/playback/effect/effect_notedelay.go b/format/xm/effect/effect_notedelay.go similarity index 100% rename from format/xm/playback/effect/effect_notedelay.go rename to format/xm/effect/effect_notedelay.go diff --git a/format/xm/playback/effect/effect_orderjump.go b/format/xm/effect/effect_orderjump.go similarity index 100% rename from format/xm/playback/effect/effect_orderjump.go rename to format/xm/effect/effect_orderjump.go diff --git a/format/xm/playback/effect/effect_panslide.go b/format/xm/effect/effect_panslide.go similarity index 100% rename from format/xm/playback/effect/effect_panslide.go rename to format/xm/effect/effect_panslide.go diff --git a/format/xm/playback/effect/effect_patterndelay.go b/format/xm/effect/effect_patterndelay.go similarity index 91% rename from format/xm/playback/effect/effect_patterndelay.go rename to format/xm/effect/effect_patterndelay.go index dccb5c8..f98c46c 100644 --- a/format/xm/playback/effect/effect_patterndelay.go +++ b/format/xm/effect/effect_patterndelay.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" ) // PatternDelay defines a pattern delay effect diff --git a/format/xm/playback/effect/effect_patternloop.go b/format/xm/effect/effect_patternloop.go similarity index 100% rename from format/xm/playback/effect/effect_patternloop.go rename to format/xm/effect/effect_patternloop.go diff --git a/format/xm/playback/effect/effect_portadown.go b/format/xm/effect/effect_portadown.go similarity index 100% rename from format/xm/playback/effect/effect_portadown.go rename to format/xm/effect/effect_portadown.go diff --git a/format/xm/playback/effect/effect_portatonote.go b/format/xm/effect/effect_portatonote.go similarity index 100% rename from format/xm/playback/effect/effect_portatonote.go rename to format/xm/effect/effect_portatonote.go diff --git a/format/xm/playback/effect/effect_portaup.go b/format/xm/effect/effect_portaup.go similarity index 100% rename from format/xm/playback/effect/effect_portaup.go rename to format/xm/effect/effect_portaup.go diff --git a/format/xm/playback/effect/effect_portavolslide.go b/format/xm/effect/effect_portavolslide.go similarity index 100% rename from format/xm/playback/effect/effect_portavolslide.go rename to format/xm/effect/effect_portavolslide.go diff --git a/format/xm/playback/effect/effect_retriggernote.go b/format/xm/effect/effect_retriggernote.go similarity index 100% rename from format/xm/playback/effect/effect_retriggernote.go rename to format/xm/effect/effect_retriggernote.go diff --git a/format/xm/playback/effect/effect_retrigvolslide.go b/format/xm/effect/effect_retrigvolslide.go similarity index 100% rename from format/xm/playback/effect/effect_retrigvolslide.go rename to format/xm/effect/effect_retrigvolslide.go diff --git a/format/xm/playback/effect/effect_rowjump.go b/format/xm/effect/effect_rowjump.go similarity index 100% rename from format/xm/playback/effect/effect_rowjump.go rename to format/xm/effect/effect_rowjump.go diff --git a/format/xm/playback/effect/effect_sampleoffset.go b/format/xm/effect/effect_sampleoffset.go similarity index 100% rename from format/xm/playback/effect/effect_sampleoffset.go rename to format/xm/effect/effect_sampleoffset.go diff --git a/format/xm/playback/effect/effect_setcoarsepanposition.go b/format/xm/effect/effect_setcoarsepanposition.go similarity index 100% rename from format/xm/playback/effect/effect_setcoarsepanposition.go rename to format/xm/effect/effect_setcoarsepanposition.go diff --git a/format/xm/playback/effect/effect_setenvelopeposition.go b/format/xm/effect/effect_setenvelopeposition.go similarity index 100% rename from format/xm/playback/effect/effect_setenvelopeposition.go rename to format/xm/effect/effect_setenvelopeposition.go diff --git a/format/xm/playback/effect/effect_setfinetune.go b/format/xm/effect/effect_setfinetune.go similarity index 100% rename from format/xm/playback/effect/effect_setfinetune.go rename to format/xm/effect/effect_setfinetune.go diff --git a/format/xm/playback/effect/effect_setglobalvolume.go b/format/xm/effect/effect_setglobalvolume.go similarity index 100% rename from format/xm/playback/effect/effect_setglobalvolume.go rename to format/xm/effect/effect_setglobalvolume.go diff --git a/format/xm/playback/effect/effect_setpanposition.go b/format/xm/effect/effect_setpanposition.go similarity index 100% rename from format/xm/playback/effect/effect_setpanposition.go rename to format/xm/effect/effect_setpanposition.go diff --git a/format/xm/playback/effect/effect_setspeed.go b/format/xm/effect/effect_setspeed.go similarity index 91% rename from format/xm/playback/effect/effect_setspeed.go rename to format/xm/effect/effect_setspeed.go index 964e868..652b394 100644 --- a/format/xm/playback/effect/effect_setspeed.go +++ b/format/xm/effect/effect_setspeed.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" ) // SetSpeed defines a set speed effect diff --git a/format/xm/playback/effect/effect_settempo.go b/format/xm/effect/effect_settempo.go similarity index 93% rename from format/xm/playback/effect/effect_settempo.go rename to format/xm/effect/effect_settempo.go index d9b210a..d84c144 100644 --- a/format/xm/playback/effect/effect_settempo.go +++ b/format/xm/effect/effect_settempo.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" ) // SetTempo defines a set tempo effect diff --git a/format/xm/playback/effect/effect_settremolowaveform.go b/format/xm/effect/effect_settremolowaveform.go similarity index 100% rename from format/xm/playback/effect/effect_settremolowaveform.go rename to format/xm/effect/effect_settremolowaveform.go diff --git a/format/xm/playback/effect/effect_setvibratowaveform.go b/format/xm/effect/effect_setvibratowaveform.go similarity index 100% rename from format/xm/playback/effect/effect_setvibratowaveform.go rename to format/xm/effect/effect_setvibratowaveform.go diff --git a/format/xm/playback/effect/effect_setvolume.go b/format/xm/effect/effect_setvolume.go similarity index 100% rename from format/xm/playback/effect/effect_setvolume.go rename to format/xm/effect/effect_setvolume.go diff --git a/format/xm/playback/effect/effect_tremolo.go b/format/xm/effect/effect_tremolo.go similarity index 100% rename from format/xm/playback/effect/effect_tremolo.go rename to format/xm/effect/effect_tremolo.go diff --git a/format/xm/playback/effect/effect_tremor.go b/format/xm/effect/effect_tremor.go similarity index 100% rename from format/xm/playback/effect/effect_tremor.go rename to format/xm/effect/effect_tremor.go diff --git a/format/xm/playback/effect/effect_vibrato.go b/format/xm/effect/effect_vibrato.go similarity index 100% rename from format/xm/playback/effect/effect_vibrato.go rename to format/xm/effect/effect_vibrato.go diff --git a/format/xm/playback/effect/effect_vibratovolslide.go b/format/xm/effect/effect_vibratovolslide.go similarity index 100% rename from format/xm/playback/effect/effect_vibratovolslide.go rename to format/xm/effect/effect_vibratovolslide.go diff --git a/format/xm/playback/effect/effect_volslide.go b/format/xm/effect/effect_volslide.go similarity index 100% rename from format/xm/playback/effect/effect_volslide.go rename to format/xm/effect/effect_volslide.go diff --git a/format/xm/playback/effect/effectfactory.go b/format/xm/effect/effectfactory.go similarity index 100% rename from format/xm/playback/effect/effectfactory.go rename to format/xm/effect/effectfactory.go diff --git a/format/xm/playback/effect/effectfactory_standard.go b/format/xm/effect/effectfactory_standard.go similarity index 100% rename from format/xm/playback/effect/effectfactory_standard.go rename to format/xm/effect/effectfactory_standard.go diff --git a/format/xm/playback/effect/effectfactory_volume.go b/format/xm/effect/effectfactory_volume.go similarity index 100% rename from format/xm/playback/effect/effectfactory_volume.go rename to format/xm/effect/effectfactory_volume.go diff --git a/format/xm/playback/effect/intf/intf.go b/format/xm/effect/intf/intf.go similarity index 100% rename from format/xm/playback/effect/intf/intf.go rename to format/xm/effect/intf/intf.go diff --git a/format/xm/playback/effect/unhandled.go b/format/xm/effect/unhandled.go similarity index 94% rename from format/xm/playback/effect/unhandled.go rename to format/xm/effect/unhandled.go index a0f65f6..8e3c0ee 100644 --- a/format/xm/playback/effect/unhandled.go +++ b/format/xm/effect/unhandled.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" xmVolume "github.com/gotracker/playback/format/xm/volume" ) diff --git a/format/xm/playback/effect/util.go b/format/xm/effect/util.go similarity index 98% rename from format/xm/playback/effect/util.go rename to format/xm/effect/util.go index 4630438..98a7a64 100644 --- a/format/xm/playback/effect/util.go +++ b/format/xm/effect/util.go @@ -6,7 +6,7 @@ import ( "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - effectIntf "github.com/gotracker/playback/format/xm/playback/effect/intf" + effectIntf "github.com/gotracker/playback/format/xm/effect/intf" xmVolume "github.com/gotracker/playback/format/xm/volume" "github.com/gotracker/playback/note" "github.com/heucuva/comparison" diff --git a/format/xm/playback/state/pattern/pattern.go b/format/xm/pattern/pattern.go similarity index 100% rename from format/xm/playback/state/pattern/pattern.go rename to format/xm/pattern/pattern.go diff --git a/format/xm/playback/channeldata_transaction.go b/format/xm/playback/channeldata_transaction.go index 0943c4c..fe7467d 100755 --- a/format/xm/playback/channeldata_transaction.go +++ b/format/xm/playback/channeldata_transaction.go @@ -5,7 +5,7 @@ import ( "github.com/gotracker/gomixing/volume" "github.com/gotracker/playback" "github.com/gotracker/playback/format/xm/channel" - "github.com/gotracker/playback/format/xm/playback/effect" + "github.com/gotracker/playback/format/xm/effect" "github.com/gotracker/playback/instrument" "github.com/gotracker/playback/note" "github.com/gotracker/playback/player/state" diff --git a/format/xm/playback/playback.go b/format/xm/playback/playback.go index d728d41..b27d997 100644 --- a/format/xm/playback/playback.go +++ b/format/xm/playback/playback.go @@ -7,8 +7,8 @@ import ( "github.com/gotracker/playback/format/xm/channel" "github.com/gotracker/playback/format/xm/layout" + "github.com/gotracker/playback/format/xm/pattern" xmPeriod "github.com/gotracker/playback/format/xm/period" - "github.com/gotracker/playback/format/xm/playback/state/pattern" "github.com/gotracker/playback/index" "github.com/gotracker/playback/note" playpattern "github.com/gotracker/playback/pattern" From 46e11220840a255f3fbd5e8ee37ff81730653ece Mon Sep 17 00:00:00 2001 From: Jason Crawford Date: Wed, 20 Jul 2022 22:10:27 -0700 Subject: [PATCH 6/6] Additional cleanup of bad types --- format/it/channel/data.go | 24 ++++++++++--------- format/it/effect/effect_portavolslide.go | 2 +- format/it/effect/effect_vibratovolslide.go | 2 +- format/it/effect/effectfactory.go | 2 +- format/it/effect/unhandled.go | 11 ++------- format/it/load/itformat.go | 2 +- format/xm/channel/data.go | 28 ++++++++++++---------- format/xm/effect/effectfactory_standard.go | 4 ++-- format/xm/effect/unhandled.go | 11 ++------- format/xm/load/xmformat.go | 2 +- 10 files changed, 39 insertions(+), 49 deletions(-) diff --git a/format/it/channel/data.go b/format/it/channel/data.go index d155676..4896593 100644 --- a/format/it/channel/data.go +++ b/format/it/channel/data.go @@ -15,6 +15,17 @@ import ( const MaxTotalChannels = 64 +type Command uint8 + +func (c Command) ToRune() rune { + switch { + case c > 0 && c <= 26: + return '@' + rune(c) + default: + panic("effect out of range") + } +} + // DataEffect is the type of a channel's EffectParameter value type DataEffect uint8 @@ -24,7 +35,7 @@ type Data struct { Note itfile.Note Instrument uint8 VolPan uint8 - Effect uint8 + Effect Command EffectParameter DataEffect } @@ -104,15 +115,6 @@ func (Data) getNoteString(n note.Note) string { } } -func (Data) getCommandString(cmd uint8) rune { - switch { - case cmd > 0 && cmd <= 26: - return '@' + rune(cmd) - default: - panic("effect out of range") - } -} - func (d Data) String() string { pieces := []string{ "...", // note @@ -130,7 +132,7 @@ func (d Data) String() string { pieces[2] = fmt.Sprintf("%02X", d.VolPan) } if d.HasCommand() && d.Effect != 0 { - pieces[3] = fmt.Sprintf("%c%02X", d.getCommandString(d.Effect), d.EffectParameter) + pieces[3] = fmt.Sprintf("%c%02X", d.Effect.ToRune(), d.EffectParameter) } return strings.Join(pieces, " ") } diff --git a/format/it/effect/effect_portavolslide.go b/format/it/effect/effect_portavolslide.go index 37b7576..e9d0cda 100644 --- a/format/it/effect/effect_portavolslide.go +++ b/format/it/effect/effect_portavolslide.go @@ -13,7 +13,7 @@ type PortaVolumeSlide struct { // 'L' } // NewPortaVolumeSlide creates a new PortaVolumeSlide object -func NewPortaVolumeSlide(mem *channel.Memory, cd uint8, val channel.DataEffect) PortaVolumeSlide { +func NewPortaVolumeSlide(mem *channel.Memory, cd channel.Command, val channel.DataEffect) PortaVolumeSlide { pvs := PortaVolumeSlide{} vs := volumeSlideFactory(mem, cd, val) pvs.Effects = append(pvs.Effects, vs, PortaToNote(0x00)) diff --git a/format/it/effect/effect_vibratovolslide.go b/format/it/effect/effect_vibratovolslide.go index 0efe5c3..20ac2d9 100644 --- a/format/it/effect/effect_vibratovolslide.go +++ b/format/it/effect/effect_vibratovolslide.go @@ -13,7 +13,7 @@ type VibratoVolumeSlide struct { // 'K' } // NewVibratoVolumeSlide creates a new VibratoVolumeSlide object -func NewVibratoVolumeSlide(mem *channel.Memory, cd uint8, val channel.DataEffect) VibratoVolumeSlide { +func NewVibratoVolumeSlide(mem *channel.Memory, cd channel.Command, val channel.DataEffect) VibratoVolumeSlide { vvs := VibratoVolumeSlide{} vs := volumeSlideFactory(mem, cd, val) vvs.Effects = append(vvs.Effects, vs, Vibrato(0x00)) diff --git a/format/it/effect/effectfactory.go b/format/it/effect/effectfactory.go index 26cf937..39a64e0 100644 --- a/format/it/effect/effectfactory.go +++ b/format/it/effect/effectfactory.go @@ -205,7 +205,7 @@ func specialNoteEffects(data *channel.Data) EffectIT { return UnhandledCommand{Command: data.Effect, Info: data.EffectParameter} } -func volumeSlideFactory(mem *channel.Memory, cd uint8, ce channel.DataEffect) EffectIT { +func volumeSlideFactory(mem *channel.Memory, cd channel.Command, ce channel.DataEffect) EffectIT { x, y := mem.VolumeSlide(channel.DataEffect(ce)) switch { case x == 0: diff --git a/format/it/effect/unhandled.go b/format/it/effect/unhandled.go index 4166ac7..493af35 100644 --- a/format/it/effect/unhandled.go +++ b/format/it/effect/unhandled.go @@ -10,7 +10,7 @@ import ( // UnhandledCommand is an unhandled command type UnhandledCommand struct { - Command uint8 + Command channel.Command Info channel.DataEffect } @@ -23,14 +23,7 @@ func (e UnhandledCommand) PreStart(cs playback.Channel[channel.Memory, channel.D } func (e UnhandledCommand) String() string { - switch { - case e.Command <= 0x09: - return fmt.Sprintf("%c%0.2x", e.Command+'0', e.Info) - case e.Command >= 0x0A && e.Command <= 0x23: - return fmt.Sprintf("%c%0.2x", e.Command+'A', e.Info) - default: - return fmt.Sprintf("?%0.2x%0.2x?", e.Command, e.Info) - } + return fmt.Sprintf("%c%0.2x", e.Command.ToRune(), e.Info) } // UnhandledVolCommand is an unhandled volume command diff --git a/format/it/load/itformat.go b/format/it/load/itformat.go index 043a5ce..8f2f995 100644 --- a/format/it/load/itformat.go +++ b/format/it/load/itformat.go @@ -72,7 +72,7 @@ func convertItPattern(pkt itfile.PackedPattern, channels int) (*pattern.Pattern[ Note: chn.Note, Instrument: chn.Instrument, VolPan: chn.VolPan, - Effect: chn.Command, + Effect: channel.Command(chn.Command), EffectParameter: channel.DataEffect(chn.CommandData), } diff --git a/format/xm/channel/data.go b/format/xm/channel/data.go index 99b6413..0d3a0e5 100644 --- a/format/xm/channel/data.go +++ b/format/xm/channel/data.go @@ -13,6 +13,19 @@ import ( "github.com/gotracker/playback/note" ) +type Command uint8 + +func (c Command) ToRune() rune { + switch { + case c <= 9: + return '0' + rune(c) + case c >= 10 && c < 36: + return 'A' + rune(c-10) + default: + panic("effect out of range") + } +} + // DataEffect is the type of a channel's EffectParameter value type DataEffect uint8 @@ -22,7 +35,7 @@ type Data struct { Note uint8 Instrument uint8 Volume xmVolume.VolEffect - Effect uint8 + Effect Command EffectParameter DataEffect } @@ -99,17 +112,6 @@ func (Data) getNoteString(n note.Note) string { } } -func (Data) getCommandString(cmd uint8) rune { - switch { - case cmd <= 9: - return '0' + rune(cmd) - case cmd >= 10 && cmd < 36: - return 'A' + rune(cmd-10) - default: - panic("effect out of range") - } -} - func (d Data) String() string { pieces := []string{ "...", // note @@ -128,7 +130,7 @@ func (d Data) String() string { pieces[2] = fmt.Sprintf("%02X", d.Volume) } if d.HasCommand() { - pieces[3] = fmt.Sprintf("%c%02X", d.getCommandString(d.Effect), d.EffectParameter) + pieces[3] = fmt.Sprintf("%c%02X", d.Effect.ToRune(), d.EffectParameter) } return strings.Join(pieces, " ") } diff --git a/format/xm/effect/effectfactory_standard.go b/format/xm/effect/effectfactory_standard.go index 5fb66ea..a32b533 100644 --- a/format/xm/effect/effectfactory_standard.go +++ b/format/xm/effect/effectfactory_standard.go @@ -68,7 +68,7 @@ func standardEffectFactory(mem *channel.Memory, cd *channel.Data) EffectXM { return UnhandledCommand{Command: cd.Effect, Info: cd.EffectParameter} } -func extraFinePortaEffectFactory(mem *channel.Memory, ce uint8, cp channel.DataEffect) EffectXM { +func extraFinePortaEffectFactory(mem *channel.Memory, ce channel.Command, cp channel.DataEffect) EffectXM { switch cp >> 4 { case 0x0: // none return nil @@ -80,7 +80,7 @@ func extraFinePortaEffectFactory(mem *channel.Memory, ce uint8, cp channel.DataE return UnhandledCommand{Command: ce, Info: cp} } -func specialEffectFactory(mem *channel.Memory, ce uint8, cp channel.DataEffect) EffectXM { +func specialEffectFactory(mem *channel.Memory, ce channel.Command, cp channel.DataEffect) EffectXM { switch cp >> 4 { case 0x1: // Fine porta up return FinePortaUp(cp) diff --git a/format/xm/effect/unhandled.go b/format/xm/effect/unhandled.go index 8e3c0ee..14ca039 100644 --- a/format/xm/effect/unhandled.go +++ b/format/xm/effect/unhandled.go @@ -11,7 +11,7 @@ import ( // UnhandledCommand is an unhandled command type UnhandledCommand struct { - Command uint8 + Command channel.Command Info channel.DataEffect } @@ -24,14 +24,7 @@ func (e UnhandledCommand) PreStart(cs playback.Channel[channel.Memory, channel.D } func (e UnhandledCommand) String() string { - switch { - case e.Command <= 0x09: - return fmt.Sprintf("%c%0.2x", e.Command+'0', e.Info) - case e.Command >= 0x0A && e.Command <= 0x23: - return fmt.Sprintf("%c%0.2x", e.Command+'A', e.Info) - default: - return fmt.Sprintf("?%0.2x%0.2x?", e.Command, e.Info) - } + return fmt.Sprintf("%c%0.2x", e.Command.ToRune(), e.Info) } // UnhandledVolCommand is an unhandled volume command diff --git a/format/xm/load/xmformat.go b/format/xm/load/xmformat.go index 2c949d3..bfe318d 100644 --- a/format/xm/load/xmformat.go +++ b/format/xm/load/xmformat.go @@ -267,7 +267,7 @@ func convertXmPattern(pkt xmfile.Pattern) (*pattern.Pattern[channel.Data], int) Note: chn.Note, Instrument: chn.Instrument, Volume: xmVolume.VolEffect(chn.Volume), - Effect: chn.Effect, + Effect: channel.Command(chn.Effect), EffectParameter: channel.DataEffect(chn.EffectParameter), } row.Channels[channelNum] = cd